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

Greetings all! Can Someone help with a script regarding animations in tools?

Asked by 4 years ago
Edited 4 years ago

Thanks for reading this, and i will give an example of the script, but I need some help with a script about animations. (specifically when you hold the tool and it plays an animation, aka - Tool Idle animation) When i hold the tool, it does play the animation, so it would seem fine, right? Wrong, the animation only plays for the holder, aka it would seem the animation is client-sided only, and this is the problem im having.

The Script:

01local tool = script.Parent
02local anim = Instance.new("Animation")
04local track
05tool.Equipped:Connect(function()
06    track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
07    track.Priority = Enum.AnimationPriority.Action
08    track.Looped = true
09    track:Play()
10end)
11tool.Unequipped:Connect(function()
12    if track then
13        track:Stop()
14    end
15end)

Can i please get some help from one of you wonderful scripters out there! :)

I would greatly appreciate it and take care in these lockdown times..

0
Just a note - The animation does play but only the holder of the tool can see it, and i need everyone in the server to see the animation ParSoft 2 — 4y
0
https://imgur.com/a/B89cRNo what im trying to do ParSoft 2 — 4y
0
https://imgur.com/a/pe5iIAC the problem ParSoft 2 — 4y

2 answers

Log in to vote
0
Answered by
Omzure 94
4 years ago
Edited 4 years ago

Try to set the priority / looped in the animation editor instead of it being scripted, and also make sure none of the baseparts are anchored

Ad
Log in to vote
0
Answered by 4 years ago

Put an global script on starter character scripts and put like this

01script.Parent.ChildAdded:Connect(function(Child)
02      if Child.ClassName == "Tool" then
03if Child:FindFirstChildOfClass("Animation") then
04local animation = script.Parent.Humanoid:LoadAnimation(Child:FindFirstChildOfClass("Animation"))
05animation:Play()
06script.Parent.ChildRemoved:Connect(function(child)
07if child == Child then
08animation:Stop()
09end)
10end
11end
12end)

Hope it works!

0
When you put my script, Dont forget to put an animation object inside the tool and put the animationid in loop and the animation type needs to be Action! So it would work shadow2008_br 176 — 4y
0
Thank you! It worked.. thanks for helping and i really appreciate it! Take care and yet again thank you ParSoft 2 — 4y

Answer this question