The script below is meant to put a 1 second cooldown on jumping, basically what I'm trying to do is make it so players can't spam jump. Instead, what my script does is disables jumping entirely which is not ideal. Here it is:
local Jumped = false local plr = game.Players.LocalPlayer local Char = plr.Character local humanoid = Char:WaitForChild("Humanoid") local UIS = game:GetService("UserInputService") local jumpCoolDown = 1 humanoid.JumpPower = 0 UIS.InputBegan:Connect(function(input) if input.Keycode == Enum.KeyCode.Space and Jumped == false then Jumped = true humanoid.JumpPower = 50 wait(0.1) humanoid.JumpPower = 0 wait(jumpCoolDown) Jumped = false end end)
Can someone suggest a fix or maybe tell me a better method to doing this, thank you.
Tiwam.
ok......
so...
sorry to say this but you made a spelling mistake.....
ur script was fine, everything was working...
line 11...
its KeyCode
not Keycode
you forgot to make the "C" capital...
script:
local Jumped = false local plr = game.Players.LocalPlayer local Char = plr.Character local humanoid = Char:WaitForChild("Humanoid") local UIS = game:GetService("UserInputService") local jumpCoolDown = 1 humanoid.JumpPower = 0 UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.Space and Jumped == false then -- I fixed it for you :) Jumped = true humanoid.JumpPower = 50 wait(0.1) humanoid.JumpPower = 0 wait(jumpCoolDown) Jumped = false end end)
Make sure not to make spelling mistakes ;)