local animController = Instance.new("AnimationController") local animTrack = animController:LoadAnimation(animation) animTrack:Play()
With clicking the humanoid this would work
For a player:
local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=144884906" -- your id here local animTrack = Humanoid:LoadAnimation(animation) -- chanhe Humanoid to the target's Humanoid animTrack:Play()
For something else:
local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=144884906" -- your id here local animController = Instance.new("AnimationController") local animTrack = animController:LoadAnimation(animation) animTrack:Play()
If you wanna launch it when a character's part is clicked, you could connect it via a Button1Down
event
You could also (though the cursor looks ugly if you don't change it) use a ClickDetector
example:
local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=144884906" -- your id here local animController = Instance.new("AnimationController") local animTrack = animController:LoadAnimation(animation) game.Players.LocalPlayer:GetMouse().Button1Down:connect(function() if game.Players.LocalPlayer:GetMouse().Target==thePartInTheModel then animTrack:Play() end end)
A script inside the Torso (with the Clickdetector already inside)
script.Parent.ClickDetector.MouseClick:connect(function(playerWhoClicked) local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=144884906" -- your id here local animTrack =script.Parent.Parent:FindFirstChild("Humanoid"):LoadAnimation(animation) -- change Humanoid to the target's Humanoid animTrack:Play() end)