There's actually a better way to handle this than using WaitForChild with the character's name! An object could potentially be added to workspace with the same name as one of the players, which would cause unpredictable behavior for certain users. ROBLOX has an event in the player called CharacterAdded, which fires every time that player's character is loaded into Workspace. In addition, all events have a wait method, which halts script execution until that event is fired.
Putting all this together, if you want to wait until the character is loaded, set up your script as follows:
local plr = game.Players.LocalPlayer
plr.CharacterAdded:wait()
wait()
local char = plr.Character
local mouse = plr:GetMouse()
The wait() was added because I've found that the event can fire slightly early (though it's inconsistent), and thus waiting for the next heartbeat will avoid any issues related to that.
4 comments
light.Parent = char:WaitForChild("Torso")*
YellowTide loves WFC
gg YellowTide LOL
It's just a fetish ok..