I made a script so that it would clone a script into the playergui but it doesnt work. I've tried 3 different ways and they all close it to 1 player instead of all the players. I've tried several times and its starting to get aggravating. I made the same code 3 different ways but they all failed.
Code1:
function endround()
local roundui= serverstore.gamestuff.UI:FindFirstChild("endUI"):Clone()
local players = game.Players:GetChildren()
x = 1,#players
if players[x] ~= nil then
local pgui = players[x]:FindFirstChild"PlayerGui"
roundui.Parent = pgui
roundui.Disabled = false
end
end
Code2:
function endround()
local roundui= serverstore.gamestuff.UI:FindFirstChild("endUI"):Clone()
wait()
local peeps = {}
for _, players in pairs (game.Players:GetChildren()) do
table.insert(peeps,players)
end
for i, player in pairs (peeps) do
if player and player.Character then
roundui.Parent = player.PlayerGui
roundui.Disabled = false
end
end
end
Code3:
function endround()
local roundui= serverstore.gamestuff.UI:FindFirstChild("endUI"):Clone()
for _, plr in pairs (game.Players:GetChildren()) do
roundui.Parent = plr.PlayerGui
roundui.Disabled = false
end
end

4 comments
Just put the script in StarterGui.
The code above is in a serverscriptservice and I can't activate scripts from client directly from there.
What? All you want is a localScript to be put into the PlayerGui, right?
yes. But I cant check the clients Player GUI using the server scripts. I've tried it 20 times. im pretty sure that doesnt work. And also I want the code activated @ a certain time.