Issue with finding child of player character

Well I just dont under stand. I want to add a crown accessory to that player but I only want one. So if char:FindFirstChild(“Crown”) then return else clone the already crown into the character. The issue is that the error in the output is attemp to index nil with FindFirstChild. Why wont this work??? image

This code is running before the character can spawn in. Meaning you tried using FindFirstChild on a nil instance. Use this line of code to wait for the player accurately.

local Players = game:GetService("Players")

local localPlayer = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()

Format it to your choice.

2 Likes

Its player.Character thats whats going into the function

Thanks forgot to wait for the character