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

My Animation can't load?

Asked by 8 years ago

I have the code finished and the sword sounds work but the animation won't load: Animation failed to load : Workspace.Player1.ClassicSword.OverheadAnim I can't figure out what is wrong. Any help is great

SwordScript

01sp.Activated:connect(function()
02    local clickdelta = tick() - lastclick -- time difference between the first time you clicked and now
03    if clickdelta > swingtime then -- Makes sure the player doesn't swing before the Swing time has passed
04        lastclick = tick()
05        hithumanoids = {} --Empty list of players that were hit in one swing, Each person hit will be added to the list. this is to make sure a single swing doesn't count at 2+ hits
06        if clickdelta < swingtime + combowindow then -- if the time is less then the swing time + the Combow time then it will advance to the next combow
07            combo = (combo + 1) % 3 -- Increses the combo by one and when the combo becomes 3, Sets it to 0
08        else
09            combo = 0
10        end
11        if player then
12            if combo == 0 then
13                event:FireClient(player, "RunAnimation", "OverheadAnim")
14                SlashSound:Play()
15            elseif combo == 1 then
View all 24 lines...

LocalSwordScript

01event.OnClientEvent:connect(function(...)
02    local tuple = {...}
03    if tuple[1] == "RunAnimation" then
04        local anim = sp:FindFirstChild(tuple[2])
05        if anim and humanoid then
06            local loadedanim = humanoid:LoadAnimation(anim)
07            if loadedanim then
08                loadedanim:Play()
09            end
10        end
11    end
12end)
0
Did you export the animation? BlackJPI 2658 — 8y
0
The Animation is apart of the "ClassicSword" in the Workplace if thats what you mean. Its its own Object. ThatArcanist 0 — 8y
0
By exported I mean that you uploaded it to roblox (i.e. the AssetID of the Animation object is a Roblox URL) BlackJPI 2658 — 8y
0
I have not ThatArcanist 0 — 8y
View all comments (3 more)
0
I belive that you have to export it in order for the LoadAnimation function to work BlackJPI 2658 — 8y
0
ok well now it says this Object must be in Workspace before loading animation. ThatArcanist 0 — 8y
0
WE GOOD ThatArcanist 0 — 8y

2 answers

Log in to vote
1
Answered by
Avectus 120
8 years ago

Make sure you export the animation to ROBLOX and perhaps add a wait() at the start of the script

Ad
Log in to vote
1
Answered by 8 years ago

Avectus good point he really forgot to add the wait() there, you see wait() can be very useful sometimes. On the wiki it describes what it does, and you should know since it's very easy. Preloading animations is useful.

Answer this question