Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I play this animation?

local animController = Instance.new("AnimationController")
local animTrack = animController:LoadAnimation(animation)
animTrack:Play()

With clicking the humanoid this would work

2 comments

0

What do you mean? Clicking the humanoid..? Please be more specific.

0

With a click detector placed in humanoid model if that makes sense.

3 answers

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)

7 comments

0

^ how would I play that in game.

0

Put it in a script, and use animTrack:Play() when you wanna animate it

0

You would not want MouseButton1Down. That would not be a GUI.

0

Could you give me a mousebutton1down event script?

1

I meant Button1Down() (edited)

0

Where does the Animation and stuff belong to?

0

why other player can't see?

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)

6 comments

0

Still doesn't seem to work I have the click detector am I doing somthing wrong?

0

What is the output?

0

Workspace.Dummy.Torso.Script:5: attempt to index a nil value 17:12:10.578 - Script 'Workspace.Dummy.Torso.Script', Line 5 17:12:10.578 - stack end 17:12:10.579 - Disconnected event because of exception 17:12:13.091 - doLoadAppearance http://www.roblox.com/Asset/?versionid=346499390&serverplaceid=0 time: 7.246339 17:12:13.215 - doLoadAppearance http://www.roblox.com/Asset/?versionid=317269006&serve

0

I fixed it nvm

0

It works when I do it test mode but not when I join it in game.

0

Start a new question and post your new script

This discussion is preserved as it was. New answers, comments, and votes are closed.