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

How come this animation check value will not work in servers?

This works fine in studio but when I go into a server or start one up I'm getting the error: 17:36:05.666 - Check is not a valid member of Tool 17:36:05.667 - Script 'Players.Player1.Backpack.Tool.Animation', Line 7

And I've checked my character with and without the tool equipped in server and check is there I've very confused because it's working perfectly fine in studio

(I have a check value so I can line the main firing script up with the animation so one can't go off without the other)

tool = script.Parent
playerMouse=game.Players.LocalPlayer:GetMouse()
player=game.Players.LocalPlayer
animation=script.Parent:WaitForChild("Animation")
enable=true
check=script.Parent.check

tool.Equipped:connect(function(mouse)
		mouse.Button1Down:connect(function()
			if check.Value==true and enable then
				check.Value = false
				enable=false
				print(enable)
				animationTrack=player.Character.Humanoid:LoadAnimation(animation)
				animationTrack:Play()
				wait(3.3)
				enable=true
				check.Value=true
			end	
		end)		
	end)

1 answer

✓ Accepted answer

Wait for check to load.

Simple enough. Use WaitForChild.

Example,

tool = script.Parent
playerMouse=game.Players.LocalPlayer:GetMouse()
player=game.Players.LocalPlayer
animation=script.Parent:WaitForChild("Animation")
enable=true
check=script.Parent:WaitForChild("check")

tool.Equipped:connect(function(mouse)
        mouse.Button1Down:connect(function()
            if check.Value==true and enable then
                check.Value = false
                enable=false
                print(enable)
                animationTrack=player.Character.Humanoid:LoadAnimation(animation)
                animationTrack:Play()
                wait(3.3)
                enable=true
                check.Value=true
            end 
        end)        
    end)

Good Luck!

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