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
local player = game:GetService("Players").LocalPlayer repeat wait() until player.Character local chr = player.Character local tool = script.Parent local handle = tool:FindFirstChild("handle") --Variables local mouse = player:GetMouse()
Fixed
local player = game:GetService("Players").LocalPlayer local chr = player.Character or player.CharacterAdded:wait() local tool = script.Parent local handle = tool:FindFirstChild("handle") --Variables 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!
First of all, instead of "repeat wait() player.Character" use "player:WaitForChild("Character")". Second, you shouldn't instatiate anymore the method "wait()" to an event, since it's deprecated. So CharacterAdded:wait() will work badly(at least for me).