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

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

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)



2 comments

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

0

No there are no errors or infinite yields.

1 answer

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