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

This animation won't play online

Asked by 10 years ago
script.Parent.ClickDetector.MouseClick:connect(function(playerWhoClicked)
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=147619125" -- your id here

local animTrack =script.Parent.Parent:FindFirstChild("Humanoid"):LoadAnimation(animation) 
-- change Humanoid to the target's Humanoid

animTrack:Play()

end)

It works in test mode but not in a server

0
Could you please use prints to tell where the execution stops working ? Hippalectryon 3 — 10y
0
It doesn't execute at all. Raditok 5 — 10y

2 answers

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago

Unless you're loading in to a NPC ( not a character ) the wiki says it has to be a LocalScript.


--LocalScript in StarterGui or StarterPack repeat wait() until game.Players.LocalPlayer local PartName = "Part1" --Name of the part you want to click. local animationId = "http://www.roblox.com/Asset?ID=147619125" local p = game.Players.LocalPlayer local mouse = p:GetMouse() mouse.Button1Down:connect(function() if mouse.Target and mouse.Target.Name == PartName then local new = Instance.new("Animation") new.AnimationId = animationId p.Character.Humanoid:LoadAnimation(new):Play() end end)
Ad
Log in to vote
0
Answered by
MunimR 125
10 years ago
script.Parent.ClickDetector.MouseClick:connect(function(playerWhoClicked)
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=147619125" -- your id here

local animTrack =playerWhoClick.Character:FindFirstChild("Humanoid"):LoadAnimation(animation)
-- change Humanoid to the target's Humanoid

animTrack:Play()

end)

You aren't loading the animation on the script's parent, you want to find the character's humanoid so take the player value that the event returns and then find the character and it's humanoid then load the animation!

1
Sorry that didn't make sense please explain? Raditok 5 — 10y
0
doesn't work Raditok 5 — 10y

Answer this question