I made a shift to run script it works well but when I reset my character, the script stops and is no longer working. Can somebody help me out with this bug?

#Here's the script

local Running = false
local Oldwalkspeed = humanoid.WalkSpeed
 
UIS.InputBegan:Connect(function(key,gameProcessed)
    if key.KeyCode == Enum.KeyCode.LeftShift then
        Running = true
    end
end)

UIS.InputEnded:Connect(function(key, gameProcessed)
    if key.KeyCode == Enum.KeyCode.LeftShift then
        Running = false
    end
end)

spawn(function()
    while wait() do
        if Running then
            humanoid.WalkSpeed = 30
        elseif not Running then
            humanoid.WalkSpeed = Oldwalkspeed
        end
    end 
end)

That's all I hope you guys can help me! I really want this bug to get fix ASAP :D

1 comment

0

Where is this script located?