I barely know what this means, I know its a problem with tool.Activated:Connect(toolActivated) but I'm not sure how to fix it. I know I need to change "toolActivated" to something but I'm not sure what. Does anyone have an idea of what I change it to? The main issue is that this script sometimes works but half the time it says nil value and it doesn't work.
01 | local sound = script.Parent.Handle:WaitForChild( "Sound" ) |
02 | local beam = script.Parent.Handle.Attachment:WaitForChild( "Beam" ) |
03 | local tool = script.Parent |
04 | local player = tool.Parent.Parent |
05 | local chargesound = script.Parent.Handle:WaitForChild( "ChargeSound" ) |
06 |
07 | local debounce = false |
08 |
09 | repeat wait( 1 ) until player.Character |
10 |
11 | local character = player.Character |
12 | local humanoid = character:WaitForChild( "Humanoid" ) |
13 |
14 | -- first animation |
15 |
toolActivated is in another event, meaning that it doesn't exist for things outside of that event, try putting the toolActivated event outside of the event, also using :Stop() on an animation when it is not already playing does not result in an error if that's why it is not outside of the event.