so i want players do be able to run by pressing left control and it works, but the problem is that pressing any other button while running just stops the player running. i don’t know how to fix this and i have searched how to do it, but i can’t seem to find the solution. i’m new to scripting so i would appreciate if anyone just tell me what i did wrong in the script or forgot. also it happens when you press any other button than the ones being pressed before running.
local userInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local isRunning = false
userInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl and isRunning == false then
player.Character.Humanoid.WalkSpeed = 32
isRunning = true
elseif isRunning == true then
player.Character.Humanoid.WalkSpeed = 16
isRunning = false
end
end)