I made about 10 animations using the animator plugin by Roblox, but how do I make a script so that when a user say a command like /e breakdance they will perform this animation: http://www.roblox.com/dancetype11-item?id=173766787 in game.
Everything used to work about several months ago, but I think Roblox now updated the animations...
First off you would need an event telling you when they've said "/e breakdance" which you can do via the .Chatted event. For example:
1 | game.PlayerAdded:connect( function (plr) --Fires when a new player joins |
2 | plr.Chatted:connect( function (msg) --Fires when the new player chats |
3 | if string.sub(msg, 1 , 3 ) = = "/e " then --Checks if it is a command |
4 | if string.sub(msg, 4 , string.len(msg)) = = "Command" then --Checks what command was said(Change "Command" to breakdance or whatever you want) |
5 | print ( "The Command goes here" ) |
6 | end |
7 | end |
8 | end ) |
9 | end ) |
Now you just need to make the character dance which can be done by creating an animation object and play it. Here's an example:
1 | local BreakDanceAnimation = Instance.new( "Animation" ) |
2 | BreakDanceAnimation .AnimationId = "http://www.roblox.com/Asset?ID=173766787" |
3 |
4 | local animTrack = plr.Character.Humanoid:LoadAnimation(BreakDanceAnimation) |
5 | animTrack:Play() |
That's all it should take. If you need more help I suggest looking at the wiki article.http://wiki.roblox.com/index.php?title=Animations