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

Problem with loading animations?

I can't seem to get animations to load. I can run the script without error, but for some reason they don't appear to work at all. Here is how I'd go about loading them:

-Gui is placed in StarterPack -LocalScript is placed inside of gui -animation is placed inside of LocalScript with an ID (220369631) -button is placed inside of gui

LocalScript:

local button = script.Parent.Button
local animation = script.Animation
local player = game.Players.LocalPlayer
local humanoid = player.Character.Humanoid

button.MouseButton1Down:connect(function()
if humanoid then
local loadanimation = humanoid:LoadAnimation(animation)
loadanimation:Play()
end
end)

1 comment

0

Is there an animation Inside the script? That looks pretty much like my script but with slight differences.

1 answer

✓ Accepted answer

The explination is here. Make sure the Animation is really in the local script. Check if the local script is in a Screen Gui. Not a Billboard or a Surface Gui.

If the animation isn't there use this script.

local anim = Instance.new("Animation", script) --Instance.new() has 2 arguments. 1. The object 2. The object's parent.
anim.AnimationId = "http://www.roblox.com/asset/?id=220369631"
local gui = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChild("Humanoid") --Find the humanoid

gui.MouseButton1Click:connect(function()
    if humanoid then --If the humanoid is real...
    local animation = humanoid:LoadAnimation(anim)
    animation:Play() --Custom animations made from players last 2 seconds long.
    end
end)

I think your problem is actually in the Link. Maybe the like was just "220369631" instead of "http://www.roblox.com/asset/?id=220369631"

1 comment

0

I got it to work, it was me using the ID instead of the URL. Thanks.

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