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

How does animation work, exactly?

Asked by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
8 years ago

I've been trying to play a test anim in order to acquaint myself with the system, following this tutorial: http://wiki.roblox.com/index.php/Animations.

I have the plugin and made the test animation, but it doesn't play. I don't know if it's a problem with the animation code, or the code for having it happen when a brick is touched.

I'd also like to know, how do I set up an if/when to play the animation?

The script in question:

local brick = workspace.Part
brick.Touched:connect(onTouch)

local animation = Instance.new("Animation")
animation.Animation.ID = "http://www.roblox.com/item.aspx?id=315360368"
local animTrack = workspace.Player.Humanoid:LoadAnimation(animation)

function onTouch(part)
    animTrack:Play()

end
0
output 1waffle1 2908 — 8y

1 answer

Log in to vote
1
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

Animations have an AnimationId property. You wrote Animation.ID instead. AnimationId has to be an asset, and not an item.

Line 5 should be animation.AnimationId="rbxassetid://315360368"

Ad

Answer this question