i have a custom movement system and i want to disable spam jumping (player holding down spacebar to keep jumping)
local Game = game
local UserInputService = Game:GetService("UserInputService")
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChildOfClass("Humanoid") or Character:WaitForChild("Humanoid")
local function OnInputBegan(InputObject)
if InputObject.KeyCode.Name == "Space" then task.wait() Humanoid:SetStateEnabled("Jumping", false) Humanoid.WalkSpeed += 10 task.wait(0.5) end
end
local function OnInputEnded(InputObject)
if InputObject.KeyCode.Name == "Space" then task.wait() Humanoid:SetStateEnabled("Jumping", true) Humanoid.WalkSpeed -= 10 task.wait(0.5) end
end
UserInputService.InputBegan:Connect(OnInputBegan)
UserInputService.InputEnded:Connect(OnInputEnded)
^ script i used before