game:GetService('Players').PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:connect(function() Voting = game.ReplicatedStorage.Voting:Clone() wait(10) Voting.Parent = player.PlayerGui end) end) end)
So, I tried making this script in hope it will re add the GUI to the player. (The GUI is cloned from replicated storage). But it only adds it to 1 player. I can't find what the problem is. Thanks.
If you are trying to make a Gui persist through death, they have this relatively new property called ResetOnSpawn
when you can check true or false from the property menu.
But if you are wondering why the Gui only goes into one player, it is because it is only going to one player here: Voting.Parent = player.PlayerGui
You would need to do something like this,
for _,get in pairs(game.Players:GetChildren()) do if get.PlayerGui then game.ReplicatedStorage.Voting:Clone().Parent = get.PlayerGui end end
If you are on Filtering Enabled however, I believe you would need to set up a RemoteEvent to go from the client that died, to the server, then back to the other clients. This is because you can't access another client's (player) PlayerGui.
-- Server scripts cannot access a player's PlayerGui --[[ Use a localscript to define the character then the died event and then clone the gui using local script. Put the local script in playerGui btw]]