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.
