local UserInpServ = game:GetService('UserInputService') local ReplicatedStorage = game:GetService('ReplicatedStorage') UserInpServ.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.E then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 72 else game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 25 end end) -- help
Firstly, I formatted your code in a code block for you.
local UserInpServ = game:GetService('UserInputService') local ReplicatedStorage = game:GetService('ReplicatedStorage') UserInpServ.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.E then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 72 else game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 25 end end)
Basically, you need to check if the keycode was E when the input ends, which will detect that it was held and you can set the walkspeed back.
Here is a fixed script
local UserInpServ = game:GetService('UserInputService') local ReplicatedStorage = game:GetService('ReplicatedStorage') UserInpServ.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.E then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 72 end end) UserInpServ.InputEnded:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.E then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 25 end end)
Thanks for reading, hope I helped.
:-)