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

How would I get animations to work without loading them in the workspace?

Asked by 8 years ago

I've been wracking my brain for the past day trying to learn how to use animations so I can animate my weapons.

I worked on the tool in the workspace and made an animation script for it

local Tool = script.Parent
local Player = game.Players.LocalPlayer
local Humanoid = Player.Character:WaitForChild("Humanoid")
local Slashing = Tool:WaitForChild("Slash")

local Animation = Tool:WaitForChild("SlashAnim")
local AnimTrack = Humanoid:LoadAnimation(Animation) 

Slashing.Changed:connect(function(mouse) 
        AnimTrack:Play()
    end)

Tool.Unequipped:connect(function() 
    AnimTrack:Stop()
end)

It's in a local script and the animation activates when a bool value is changed. When I got it in the game and used it, the animations worked-- so I moved it into the starterpack. Now, whenever I try to use it from the starterpack the output tells me "Object must be in Workspace before loading animation."

I don't fully understand how most of the Roblox gears are able to do this either, so could someone explain how would I get the animations to work now and how I can avoid this problem in the future? ;o;

Answer this question