Script:
local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local Character = Player.Character
UIS.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.W then
local Anim = Instance.new('Animation')
Anim.AnimationId = 'rbxassetid://1667958741'
PlayAnim = Character.Humanoid:LoadAnimation(Anim)
PlayAnim:Play()
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.W then
Character.Humanoid.WalkSpeed = 16
PlayAnim:Stop()
end
end)

9 comments
-_- Pretty sure connect does work. Why do you insist on forcing your standards on everyone?
Doesn’t. Connect does though.
Nope. It still works. Nevertheless, it is better to switch to Connect since connect could possible be removed in near future.
connect works.
Not having any issues from any of my places despite ALL of my scripts having connect in them, liar. Even the controlscripts still have connect in them.
I get the error "connect is not a valid member of RBXScriptSignal". And Zafirua that’s why people should switch to Connect.
The only problem is that i want the animation to stop whenever i release the keys.
I never got that error before tbh. No need to get mad though Melt, always better to use updated code.
Can someone make it so whenever i release the keys the animation stops?