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

How do I script made animations into a dance game?

Asked by 6 years ago

How do I make codes for animations. I'm trying to make an animation for my dancing game and i know how to make animations but I'm having a hard time scripting them in my game. Do you know how to script them into games?

1 answer

Log in to vote
0
Answered by 6 years ago

I'm not the best at scripting, so my answer may be wrong, but as long as you have the ID of the animations you made, this script should (hopefully) work for you.

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local Char = player.Character
local Humanoid = Char:WaitForChild("Humanoid")



local animations = {1877306614,1877291193,01895620990} --Change the numbers into the IDs of your animations

local function Animation(plr)
    local animation = Instance.new("Animation")
    local picked = math.random(1, #animations)
    animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked]
    local animTrack = Humanoid:LoadAnimation(animation)
    animTrack:Play()
end

Mouse.Button1Down:connect(function()
    print("PlayAnimation")
    Animation()
    end)

This script should play one of your animations at random when you click. You might want to add a debounce script or something like that to prevent others from playing the animations too quickly.

0
tysm! goldenpatterns 0 — 6y
0
No problem! I hope it works fine :) McQuakyDuck 8 — 6y
0
It's a giant help though I've been stressed about this for DAYS and you're a giant help. goldenpatterns 0 — 6y
0
A few questions... So does this only play one animation? And where do the animations show? goldenpatterns 0 — 6y
View all comments (4 more)
0
Glad I could relieve that stress lol McQuakyDuck 8 — 6y
0
Well, I'm assuming you're animating a humanoid (The player), and all this script does is play a different animation on the humanoid (From the IDs of your animations you put) every time the player clicks with their mouse. However, there is a problem that the player could just spam click and the animation wont finish, so you might want to add a debounce to prevent that. McQuakyDuck 8 — 6y
0
Sorry if I'm not being clear lol, I'm used to asking the questions not giving answers :P McQuakyDuck 8 — 6y
0
ok. goldenpatterns 0 — 6y
Ad

Answer this question