When i press left shift the animation stays the same and the walkspeed stays the same


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		wait(1) 
		local human = char.Humanoid
		local mous = player:GetMouse()
		local humoid = player.Character:WaitForChild("Humanoid")
player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=2653244376"
		
		local UIS = game:GetService("UserInputService")

UIS.InputBegan:connect(function(Input)
    local MouseInput = Input.UserInputType
local KeyCode = Input.KeyCode

    if KeyCode == Enum.KeyCode.LeftShift then
        human.Walkspeed = 30
player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=2654943642"
    end
end)

UIS.InputEnded:connect(function(Input)
    local MouseInput = Input.UserInputType
local KeyCode = Input.KeyCode

if KeyCode == Enum.KeyCode.LeftShift then
        human.Walkspeed = 16
player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=2653244376"

    end
			
		end)
	end)
	end)

3 comments

0

Use this in LocalScript. And use :Connect not :connect

0

Where would i put the LocalScript then?

1

StarterGui and remove game.Players.PlayerAdded, put local player = game.Players.LocalPlayer (in localscript)