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

How would I play this animation?

Asked by 10 years ago
local animController = Instance.new("AnimationController")
local animTrack = animController:LoadAnimation(animation)
animTrack:Play()

With clicking the humanoid this would work

0
What do you mean? Clicking the humanoid..? Please be more specific. AmericanStripes 610 — 10y
0
With a click detector placed in humanoid model if that makes sense. Raditok 5 — 10y

3 answers

Log in to vote
2
Answered by 10 years ago

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)
0
^ how would I play that in game. Raditok 5 — 10y
0
Put it in a script, and use animTrack:Play() when you wanna animate it Hippalectryon 3 — 10y
0
You would not want MouseButton1Down. That would not be a GUI. AmericanStripes 610 — 10y
0
Could you give me a mousebutton1down event script? Raditok 5 — 10y
View all comments (3 more)
1
I meant Button1Down() (edited) Hippalectryon 3 — 10y
0
Where does the Animation and stuff belong to? RicheeNektar 78 — 7y
0
why other player can't see? stupidodot 0 — 3y
Ad
Log in to vote
0
Answered by 10 years ago

I tried this script and it just freezes studio :(

Log in to vote
-2
Answered by 10 years ago

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)
0
Still doesn't seem to work I have the click detector am I doing somthing wrong? Raditok 5 — 10y
0
What is the output? AmericanStripes 610 — 10y
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 Raditok 5 — 10y
0
I fixed it nvm Raditok 5 — 10y
View all comments (2 more)
0
It works when I do it test mode but not when I join it in game. Raditok 5 — 10y
0
Start a new question and post your new script Hippalectryon 3 — 10y

Answer this question