If statement giving error instead of moving on

The problem that I face is when the remote event is fired, it checks for what type of sign the player is holding. However, when it can’t find that specific sign, it just throws an error instead of moving onto the next statement. Code:

game.ReplicatedStorage.ChangeSignText.OnServerEvent:Connect(function(player, text)
	if player.Character.Sign then
		player.Character.Sign.Handle.Sign.SurfaceGui.TextLabel.Text = text
	end
	
	if player.Character.GoldSign then
		player.Character.GoldSign.Handle.Sign.SurfaceGui.TextLabel.Text = text
	end
end)

All help appreciated! <3.

Change

if player.Character.Sign then

To

if player.Character:FindFirstChild("Sign") then

And

if player.Character.GoldSign then

To

if player.Character:FindFirstChild("GoldSign") then

If you’re uncertain something exists in the character then use FindFirstChild

1 Like