In this game, I'm trying to have a target system where you have to hunt down an NPC with a specific color hat. A GUI is used to tell a player what colored hat the NPC is wearing, and the GUI is supposed to display an X symbol during the delay where the new target is chosen.

The part of the script which finds the hat color that the NPC is wearing and updates the GUI works, but it doesn't display an X during the delay in which a new target is chosen and the old NPC respawns. (this is a 5 second delay if you need to know)

I didn't make the respawn script, so I'm not 100% sure how it works. I'm pretty sure it's not an issue with waiting for the player to spawn in. But I tried to make comments to make it a bit readable.

local script that changes the GUI

--local script found in starter GUI under imagelabel
_G.isCamperDead = false
local counter = 1

--array filled with symbols
campColorArray = {
				 "http://www.roblox.com/asset/?id=2254302918", --red hat
				 "http://www.roblox.com/asset/?id=2254302303", --blue hat
				 "http://www.roblox.com/asset/?id=2254331503", --yellow hat
				 "http://www.roblox.com/asset/?id=2254302721", --cyan hat
				 "http://www.roblox.com/asset/?id=2254302522", --camo hat
				 "http://www.roblox.com/asset/?id=2256726772"  --x
				 }
function camperAlive()
	if _G.isCamperDead == false then
		if game.Workspace.campingSite.camper1:FindFirstChild("targetCamperB") then --finding the target
			if game.Workspace.campingSite.camper1.targetCamperB:FindFirstChild(counter) then --determining the color of their hat
				wait(0.2)
				script.Parent.Image = campColorArray[counter]
				counter = 1 --resets when finished
			else
				wait(0.2)
				counter = counter + 1
				if counter == 6 then
					counter = 1 --resets if not found
				end
			end
		end
	end
end


while wait() do	
	if _G.isCamperDead == false then
		camperAlive()
	else
		script.Parent.Image = "http://www.roblox.com/asset/?id=2256726772" --does not work for some reason
	end
end

respawn script

--script found in target NPC
target = script.Parent:clone()
local campsite = game.Workspace.campingSite.camper1
_G.isCamperDead = false

function Dead()
	_G.isCamperDead = true
	game.StarterGui.TargetGui.TargetHat.Image = "http://www.roblox.com/asset/?id=2256726772" --attempt to change the player's gui to an x
	wait(5) --delay between respawn

	local respawn=target:clone()
	respawn.Parent=script.Parent.Parent
	respawn:makeJoints()
	script.Parent:remove()
	
	game.Workspace.campingSite.camper1.targetCamperB.Name = "randomCamperC" --used to disable choosing of same npc twice in a row as target
	game.Workspace.campingSite.camper1.randomCamperC.Humanoid.MaxHealth = 0 --invincible when not a target
	game.Workspace.campingSite.camper1.randomCamperC.Humanoid.Health = 0
	_G.newTarget = true --find a new target
	
	game.Workspace.campingSite.camper1.randomCamperC.Parent = game.Workspace.campingSite.camper2 --puts in a new group so it doesn't alternate between only 2 targets
	game.Workspace.campingSite.camper2.randomCamperC.Respawning:Destroy() --self destruct
end

script.Parent.Humanoid.Died:connect(Dead)