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

Why does the server not receive values if animation are loaded in this script?

Asked by 2 years ago

In this script the chunk at the top is loaded animations. These are there to specify when to assign values based on animation. The values show up clearly for me in the properties tab, yet other ingame objects always see the value as 0.


local chara = script.Parent.Parent local anim1 = script.Parent:WaitForChild("swing") local swinganim = chara.Humanoid:LoadAnimation(anim1) local anim2 = script.Parent:WaitForChild("idle") local idleanim = chara.Humanoid:LoadAnimation(anim2) local special = script.Parent:WaitForChild("special") local specialanim = chara.Humanoid:LoadAnimation(special) script.Parent.active.Value = 0 script.Parent.Activated:Connect(function() wait(0.01) if script.Parent.special.IsPlaying == true then script.Parent.active.Value = 1 wait(5) script.Parent.active.Value = 0 else script.Parent.active.Value = 1 wait(0.7) script.Parent.active.Value = 0 end end)

Now the same script, with the animations removed, works perfectly fine. Why?




script.Parent.active.Value = 0 script.Parent.Activated:Connect(function() wait(0.01) script.Parent.active.Value = 1 wait(0.7) script.Parent.active.Value = 0 end)
0
Are you seeing any warnings, perhaps an infinite yield? There's a chance the swing/idle/special animations sometimes do not exist. Also it is better to play an animation on the Humanoid's Animator Shawnyg 4330 — 2y
0
No there are no errors or infinite yields. Stiles8353 35 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

Fixed it myself by learning about remote events

Ad

Answer this question