I have a regular script inside of a tool used by the player. The tool loads as soon as the game starts, and it is inside their backpack. It looks for the local player and the Character at the start of the script, but it is not working.
player = game:GetService("Players").LocalPlayer
Character = player.Character or player.CharacterAdded:Wait()
Is there something I can do to allow it to work? I’ve tried adding a wait() at the very top of the script but the output still gives me an error with "Attempt to index nil with ‘Character’.
You said that you have e regular script inside the tool? If yes then you have to know that you can’t get the local player from a regular script, use a local script instead
This is probably the reason, good catch. I misread. .LocalPlayer is only accessible from a LocalScript. If you need to use a normal script, find a different method of referencing the player or change it to a LocalScript instead.
Success! I altered the code a little bit for it to be “script.Parent.Parent.Parent” so it could address the player instead of the backpack. Script seems to work now.