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

How to play an animation with a tool?

Asked by 6 years ago

Hello. I made an animation and a script for a tool. When I click, the animation is supposed to play. Instead nothing happens. If I quickly unequip the tool, the animation plays. Is there a way to make the animation play WITH the tool?

Here is the script:

function onClicked(plr)
    local ex = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
    ex:Play()
end

script.Parent.Activated:connect(onClicked)

Thanks

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Make this script below a local script after making, this goes in the tool.

plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
function onClicked(plr)
send = script.Parent.Send--Make a RemoveEvent in the tool as well, name it "Send" .
Send:FireServer()
end

mouse.Button1Down:connect(onClicked)

Make this script below a script after making, this goes in the tool.


send = script.Parent.Send send.OnServerEvent:connect(function(plr) ex = plr.Character.Humanoid:LoadAnimation(script.Parent.Animation) ex:Play(1.0) end)

Thats it! If this worked please mark my question the answer so I can get more reputation so I can help others.

0
Thanks for posting. Sadly these scripts do the same thing as my original script. bluestreakejjp 41 — 6y
0
Can I have the animation ID? HeComesAt_Night 116 — 6y
0
Sure, the ID is 1579421340 bluestreakejjp 41 — 6y
0
Alright, let me do some testing HeComesAt_Night 116 — 6y
View all comments (6 more)
0
Ok thanks bluestreakejjp 41 — 6y
0
It says the ID is invalid..Are you sure its correct? HeComesAt_Night 116 — 6y
0
Yes I'm sure it is correct, here is the animation. https://www.roblox.com/library/1579421340/Drink2 bluestreakejjp 41 — 6y
0
Look at the edit, I also found out I cant help you anymore, I found out the Animation only works with the "owner" of the animation. HeComesAt_Night 116 — 6y
0
The new script didn't work, but thanks for trying to help anyway. bluestreakejjp 41 — 6y
0
Welcome. HeComesAt_Night 116 — 6y
Ad

Answer this question