Could you help with this? It currently just makes the walkspeed 0 when x is pressed.
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local character = Player.Character
function speed(speed)
character.Humanoid.WalkSpeed = speed
end
Mouse.KeyDown:connect(function(Key)
if Key == "x" then
speed(0)
end
end)
How can I make this so if the player presses x a second time the speed would go back to 16? I'm not sure how to state if the key is pressed again.
