Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help with my animations? They work in the studio but not in the game

Asked by
fadinqkid -18
5 years ago

here is the script

anime = script.Parent.name.Value

script.Parent.Selected:connect(function(m) m.Button1Down:connect(function() hum = game.Players.LocalPlayer.Character.Humanoid anim_feet = hum:LoadAnimation(script.Parent.Animation) current = anim_feet current:Play() end) end)

0
Can you put your code in a code block MythicalShade 420 — 5y
0
connect is deprecated. Use Connect. green271 635 — 5y
0
HopperBins are deprecated. Use Tools with the RequiresHandle property set to false for a similar effect. User#19524 175 — 5y

1 answer

Log in to vote
0
Answered by
AIphanium 124
5 years ago
Edited 5 years ago

Hello, fadinqkid!

I have written a script for you!

mouse = game.Players.LocalPlayer:GetMouse()
 Human = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

 YourAnimation = script.Animation -- Place your animation inside the script, then change its name to Animation.

 AnimationPLAYER = Human:LoadAnimation(YourAnimation)

mouse.Button1Down:Connect(function()
Human.WalkSpeed = 0 -- Animations stop when a player moves, but now it doesn't ;)
Wait(1)
AnimationPLAYER:Play() -- Loop the animation, otherwise, it will stop.
end)

mouse.Button1Up:Connect(function() -- We don't want the animation to play forever, right?
Wait(1)
Human.WalkSpeed = 16
AnimationPLAYER:Stop()
end)

-- Good Luck!

---- AIphanium

0
Only works with a LocalScript, and also, this script doesn't care if a tool is equipped or not. AIphanium 124 — 5y
Ad

Answer this question