Why does this GUI not update to an X symbol during a live game? [closed]
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
02 | _G.isCamperDead = false |
15 | if _G.isCamperDead = = false then |
16 | if game.Workspace.campingSite.camper 1 :FindFirstChild( "targetCamperB" ) then |
17 | if game.Workspace.campingSite.camper 1. targetCamperB:FindFirstChild(counter) then |
19 | script.Parent.Image = campColorArray [ counter ] |
34 | if _G.isCamperDead = = false then |
respawn script
02 | target = script.Parent:clone() |
03 | local campsite = game.Workspace.campingSite.camper 1 |
04 | _G.isCamperDead = false |
07 | _G.isCamperDead = true |
11 | local respawn = target:clone() |
12 | respawn.Parent = script.Parent.Parent |
14 | script.Parent:remove() |
16 | game.Workspace.campingSite.camper 1. targetCamperB.Name = "randomCamperC" |
17 | game.Workspace.campingSite.camper 1. randomCamperC.Humanoid.MaxHealth = 0 |
18 | game.Workspace.campingSite.camper 1. randomCamperC.Humanoid.Health = 0 |
21 | game.Workspace.campingSite.camper 1. randomCamperC.Parent = game.Workspace.campingSite.camper 2 |
22 | game.Workspace.campingSite.camper 2. randomCamperC.Respawning:Destroy() |
25 | script.Parent.Humanoid.Died:connect(Dead) |