generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Keydown issues in play mode

Previous Thread :: Next Thread 
RoboTestGear is not online. RoboTestGear
Joined: 28 Dec 2009
Total Posts: 3063
07 Jan 2013 07:52 AM
This is in a script in game.Workspace.Model
It seems to work perfectly in solo play. I set up some hints to try
and get some errors. It kept getting "Selected" then no keydown connection
(Yes I clicked keys to make sure of this)


function MainDriver(Player) --Steer controler
if Player.ClassName == "Weld" then
Player = game.Players:findFirstChild(Player.Part1.Parent.Name)
if Player:findFirstChild("PlayerGui") then
Control1 = script.ControlGui:Clone()
Control1.Parent = Player.PlayerGui
Control11 = Instance.new("HopperBin",Player.Backpack)
local DriverTool = Control11

local function KeyDown(Key) ------------Error apparently
Hint.Text = "Keys loaded"
if Key==Controls["DoorOpen"] then
if script.Parent.Doors.Door.Transparency == 0 then
script.Parent.Doors.Door.Transparency = 1
script.Parent.Doors.Door.CanCollide = false
script.Parent.Doors.Door2.Transparency = 0
script.Parent.Doors.Door2.CanCollide = true
else
script.Parent.Doors.Door.Transparency = 0
script.Parent.Doors.Door.CanCollide = true
script.Parent.Doors.Door2.Transparency = 1
script.Parent.Doors.Door2.CanCollide = false
end
end
if Key==Controls["SteerRight"] then
Steer = 1
elseif Key==Controls["SteerLeft"] then
Steer = -1
end
end

local function KeyUp(Key)
if Key==Controls["SteerRight"] then
Steer = 0
elseif Key==Controls["SteerLeft"] then
Steer = 0
end
end

local function Selected(mouse)
Hint.Text = "Selected"
mouse.KeyDown:connect(function(key) Hint.Text = "Keydown!" KeyDown(key) end)
mouse.KeyUp:connect(function(key) Hint.Text = "KeyUp!" KeyUp(key) end)
if mouse == nil then Hint.Text = "Mouse nil." end
end
DriverTool.Selected:connect(Selected)
DriverTool.Parent = Player.Backpack
Hint.Text = "MainDriver added"
end
end
end
Report Abuse
coltman188888 is not online. coltman188888
Joined: 09 May 2009
Total Posts: 9330
07 Jan 2013 07:58 AM
Roblox decided to attempt to make everyone happy and, in doing so, removed the mouse function for normal scripts. Mouse can only be accessed on client(LocalScripts) now thanks to their great ideas.
Report Abuse
RoboTestGear is not online. RoboTestGear
Joined: 28 Dec 2009
Total Posts: 3063
07 Jan 2013 08:01 AM
Script doesn't even work as a local. Lol.
Report Abuse
Monkey727 is not online. Monkey727
Joined: 12 Jan 2009
Total Posts: 969
07 Jan 2013 08:06 AM
Local Scripts only run inside the Player, e.g. Player's Character, PlayerGui, Backpack, Tool/Hopperbin
Report Abuse
RoboTestGear is not online. RoboTestGear
Joined: 28 Dec 2009
Total Posts: 3063
07 Jan 2013 08:11 AM
Considering all the glitches Local Scripts seem to have in play, I don't think that's the case anymore.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image