For some reason, I can’t seem to detect a player using a LOCAL script in StarterPlayerScripts, however, it does detect the player adding to the game but when it trys to find the player, it doesn’t work?
Here’s the code:
local player = game.Players.LocalPlayer
local playergui = player:WaitForChild("PlayerGui")
local char = player.Character
player.CharacterAdded:Connect(function()
print("Player Character has been loaded!")
end)
while wait(1) do
if char then --not detecting if the character has been found?
if char.Humanoid.Died then
playergui.ToolsGui.Enabled = true --I have tried :WaitForChild and :FindFirstChild, but I just tried this for instance.
else
playergui.ToolsGui.Enabled = false
end
else
warn("Player has not loaded!")
end
end
Yes I know, it’s such a simple piece of code, lmao.
Please help if you know!