I've tried to do this by using _G variable in a respawn script in order to signal when the NPC died, but this didn't work on the live game.
The respawn script was a regular script and the gui script was a local script in the starter gui of a player.
Could someone give a quick example? The basic respawn script is below if that helps, I'm pretty sure it has all the necessary parts.
target = script.Parent:Clone() function Dead() local respawn=target:Clone() respawn.Parent=script.Parent.Parent respawn:MakeJoints() script.Parent:Destroy() end script.Parent.Humanoid.Died:Connect(Dead)
So you'd need to create a RemoteEvent to be able to pass the death event to the client.
--Warning: Untested code! I'm typing right into this SH answer! local event = game.ReplicatedStorage.RemoteEvent local target = script.Parent:Clone() function Dead() local respawn = target:Clone() respawn.Parent = script.Parent.Parent respawn:MakeJoints() script.Parent:Destroy() event:FireAllClients() end script.Parent.Humanoid.Died:Connect(Dead)
This will now fire the event to all the players that the Humanoid died! Now, we need to handle that on the client!
local event = game.ReplicatedStorage.RemoteEvent event.OnClientEvent:Connect(function() print("Humaoid died!") --Change the GUI end)
Please remember to upvote if this helps, and accept this answer if it works!