I can see why this wouldn’t work… does anyone have any ideas on how to fix this?
local ui = game.ReplicatedStorage.ReplicatedUI
game.Players.PlayerAdded:Connect(function(plr)
local uiobject = ui.StartUI:Clone()
uiobject.Parent = plr.PlayerGui
local character = plr.Character or plr.CharacterAdded:Wait()
character.Humanoid.Died:Connect(function()
local uiobject = ui.StartUI:Clone()
uiobject.Parent = plr.PlayerGui
character = plr.Character or plr.CharacterAdded:Wait()
end)
end)
Sorry. The issue here is that the ui only clones into the player twice (once when they load in, again when they first die). My suspicion is that the humanoid.Died event is connected to the original character, and not the updated reference that is created when the event fires. Do you know any way of how i might remedy this problem?
Edit: I missed that you’re already using it, so I’m gonna reword the way I said that (sorry!)
Basically what I’d do is instead of using plr.CharacterAdded:Wait(), I’d wrap it into the event handler. Then it’ll keep running every time the player spawns and fix your problem.
I feel like a forever loop would consume a lot more resources on the server, and the event listeners are a better way to go. thanks for offering though