Hello,
My script, which is inside a tool, stops working whenever I try to create a variable for humanoid to play some animations.
For some time I was able to stop the bug by putting the variables into a tool.Equipped function like this
But the next day when I try to play animations it stops and gives me this
and the entire script stops and nothing works
I tried using using different methods but none of them worked
3 Likes
astraIboy
(The Batman)
July 25, 2023, 12:57pm
#2
Have you tried defining the humanoid before the tool.Activated
function
2 Likes
I have but it says “Attempt to index nil with WaitForChild”
2 Likes
astraIboy
(The Batman)
July 25, 2023, 12:59pm
#4
This means that it can’t find the character, did you define that outside and before the humanoid?
1 Like
Yes, here is the code for the variables
1 Like
astraIboy
(The Batman)
July 25, 2023, 1:02pm
#6
Try doing player.Character or player.CharacterAdded:Wait()
when defining the char variable
2 Likes
exwumm
(exwum)
July 25, 2023, 1:03pm
#7
Is the script a LocalScript or a regular script?
1 Like
Its a local script located in a tool
astraIboy
(The Batman)
July 25, 2023, 1:03pm
#9
its a local script because if it wasnt then local player wouldnt have been found and wouldve errored
1 Like
astraIboy
(The Batman)
July 25, 2023, 1:04pm
#11
Actually that isn’t exactly neccessary it’s better to define it outside of the tool rather then retrieve them every time the player activates the tool
1 Like
This worked! Thank you I used the player.CharacterAdded:Wait()
1 Like
system
(system)
Closed
August 8, 2023, 1:08pm
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.