Wait is not a valid member?[Solved]
So I am basically trying to access a local player character but it gives me this weird error when I am waiting for it to load.
Inside a tool, localscript
1 | local player = game:GetService( "Players" ).LocalPlayer |
2 | repeat wait() until player.Character |
3 | local chr = player.Character |
4 | local tool = script.Parent |
5 | local handle = tool:FindFirstChild( "handle" ) |
6 | local mouse = player:GetMouse() |
Fixed
1 | local player = game:GetService( "Players" ).LocalPlayer |
2 | local chr = player.Character or player.CharacterAdded:wait() |
3 | local tool = script.Parent |
4 | local handle = tool:FindFirstChild( "handle" ) |
5 | local mouse = player:GetMouse() |
Output
22:01:21.180 - Wait is not a valid member
22:01:21.181 - Script 'Players.Player1.Backpack.Tool.LocalScript', Line 2
22:01:21.181 - Stack End
Error appears before I equip the tool!