So I'm having an issue right now creating a tool. This message popped out when I played in online mode. The error comes from line 3. Do you know how to fix it?
Btw, it is a localscript
local t = script.Parent
local player = game.Players.LocalPlayer.Character
local torso = player:WaitForChild("Torso")

6 comments
probably you should wait for the character to load
There's a WaitForChild at the third line, so I don't think thats the issue
but it uses the variable to get the torso though
It is the issue. Define the player in one line (using just local player = game.Players.LocalPlayer) and then the character in the next (using player.Character or player.CharacterAdded:Wait()). This way, the script will wait for the character to load.
Or, you can actually just do it in one line like so: local player = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait(). I would opt for the first option though as the player variable will most likely come in handy later and that way you can have a variable for both the player and the character.
My tool works now. Thanks alot guys