--This works, also playercharacter is defined.
if playercharacter:FindFirstChild("Animate"):FindFirstChild("run") then playercharacter:FindFirstChild("Animate"):FindFirstChild("run"):Destroy() end
--However this doesn't work
if playercharacter:FindFirstChild("Animate"):FindFirstChild("run") then playercharacter:FindFirstChild("Animate"):Destroy() end
Can someone explain why the second one doesn't work? I have to remove the ":FindFirstChild("run")" before the "then" for it to work, but why? It finds "Animate" anyway, so what's stopping it from destroying it?

10 comments
Your code works perfectly fine for me, both of them. Not sure why it's not working for you, maybe an interfering script?
I have no idea. It only happens half the times I run the game. I get an error saying attempt to index nil value.
That's because the script didn't find "Animate" when it ran. Therefore FindFirstChild returned nil. Add an if statement to check if Animate exists.
Yes but how come it finds it in the first code?
I can also see them in explorer. They get destroyed, but I still get the error and the code afterwards doesn't work. This shows that it found it.
Did you do what incapaz said? If so what changed?
I didn't do it because the script finds 'Animate'. I know this because it does get destroyed.
whats the point of typing all that twice anyway? It would be a lot easier to just make it a variable then do if variable then variable:Destroy() end
capital r? in run? idk
Nope.