#Code Refuses To Stop Animation

35 messages · Page 1 of 1 (latest)

regal talon
#

The local isplaying in your function isn't the same as the one you declared globally - they're separate variables under the same name

#

If you want to update the global variable, remove the "local" for isplaying inside your function

meager crescent
#

ooooh okay, I'll try that then, thanks.

#

like this, right? because now it won't play the animation in the first place

regal talon
#

Oh that's because you have two separate if statements. Try doing If, else instead

meager crescent
#

alright, I'll do that then.

#

like this, right?

#

oh wait woops

#

forgot to remove part from before XD

regal talon
#

Yeah should be good

meager crescent
#

well, it still won't play the animation now.

sour stirrupBOT
#

studio** You are now Level 3! **studio

meager crescent
#

actually, restarting the game, now it DOES play the animation but still just won't stop the animation.

regal talon
#

Or line 5 and 6

meager crescent
#

I've done that previously as well and any time I have it's just refused to play the animation at all, but I'll try it again.

#

yeah no it won't play the animation now.

#

this script here, it doesn't play the animation.

regal talon
#

Do you have any errors in output?

meager crescent
#

I've never even gotten any output from anything

#

not even print beforehand has given me any outputs

regal talon
#

Go to View tab and hover over an icon button called "Output". Should be around the top left of View tab then click on that

meager crescent
#

ooooh okay, I actually thought output was on by default XD

#

bruh one of my scripts randomly disappeared that controls the GUI I need to test my code.

#

alright, so, here's the output.

regal talon
#

Figured the issue might be related to this

#

Ok replace line 3 with this:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")

meager crescent
#

okay, well, I actually just replaced the FindFirstChild with WaitForChild, and that works perfectly

#

it both plays, and stops, the animation now. thanks for your help!

regal talon
#

Yeah I just want to point out one more thing

#

The reason why you're receiving that error is because sometimes the script will run before the humanoid even gets the chance to completely load

meager crescent
#

yeah I assumed so after noticing you changed it from FindFirstChild to WaitForChild

#

I just kinda assumed the player model was loaded before the script in the UI XD

regal talon
#

Yeah just be careful with Player Character models too, sometimes they don't load in as expected