Why isn't this script working? Everything seems correct. This is a local script in startergui.
local debounce = false local plyr = game.Players.LocalPlayer local mouse = plyr:GetMouse() mouse.KeyDown:connect(function(key) if not debounce then debounce = true if string.lower(key) == "r" then plyr:LoadCharacter() wait(3) debounce = false elseif key:byte() == 63 then game.Lighting.HELP:Clone().Parent = plyr.PlayerGui wait(3) debounce = false end end end)
( Note : <http://wiki.roblox.com/index.php?title=Taking_keyboard_input >)
local debounce = false local plyr = game.Players.LocalPlayer local mouse = plyr:GetMouse() mouse.KeyDown:connect(function(key) if debounce == false and key == 'r' then -- Works just fine debounce = true plyr:LoadCharacter() delay(3,function() debounce = false end) elseif key == 'q' and debounce==false then -- There is no 63 byte game.Lighting.HELP:Clone().Parent = plyr.PlayerGui delay(3,function() debounce = true end) end end)
Try using this code as the first line.
wait(.5)
This usually fixes things for local scripts not always working. Due to local scripts loading faster than some player aspects this usually helps with letting them load first. If this doesn't work try adding a:
print(key)
, inside of the mouse.KeyDown:connect(function(key), as the next line in it. Here is the code that I think may work.
wait(.5) local debounce = false local plyr = game.Players.LocalPlayer local mouse = plyr:GetMouse() mouse.KeyDown:connect(function(key) print(key) if not debounce then debounce = true if string.lower(key) == "r" then plyr:LoadCharacter() wait(3) debounce = false elseif key:byte() == 63 then game.Lighting.HELP:Clone().Parent = plyr.PlayerGui wait(3) debounce = false end end end)
Locked by EzraNehemiah_TF2, Redbullusa, and BlueTaslem
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?