I’m trying to make the player increase in walkspeed when the player presses a button
everything seems to work until i want to lower the walkspeed, i’m not sure if this is something wrong with my script or if this is an issue with the game engine, no errors show up either.
Heres the script, i feel like this a super simple fix and i would feel kinda dumb if this is
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local humrp = char:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
local DB = false
local Running = false
UIS.InputBegan:Connect(function(input, isTyping)
if UIS:IsKeyDown(Enum.KeyCode.W) and UIS:IsKeyDown(Enum.KeyCode.LeftShift) then
if isTyping then return else
if DB == false then
if Running == false then
DB = true
Running = true
hum.WalkSpeed = 30
wait(0.1)
DB = false
end
end
end
end
end)
UIS.InputEnded:Connect(function(input, isTyping)
if input == Enum.KeyCode.LeftShift then
if Running == true then
if isTyping then return else
Running = false
hum.WalkSpeed = 14
end
end
end
end)
any solutions? any help is appreciated