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

Problem with loading animations?

Asked by 9 years ago

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)
0
Is there an animation Inside the script? That looks pretty much like my script but with slight differences. EzraNehemiah_TF2 3552 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

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"

0
I got it to work, it was me using the ID instead of the URL. Thanks. aquathorn321 858 — 9y
Ad

Answer this question