Why does my Gui not show up to the others?

I want to make a screen where anyone can see it, but it wont show up on others when I play with test. Also I’m new here and starting posting, this is my first post.

Here’s the problem:


Also its in workspace. I tried using RemoteEvent but it didn’t work, please help.

(don’t ask my grammar)

Also it doesn’t work on ServerScriptService, I don’t know why.

More explanation:

It’s because the thread is infinitely yielded.

How do I fix the thread infinitely yielded? I only know some code’s.

The issue is the “while” loop inside the first “for” loop. When you have an infinite while loop inside a script, the script will get stuck on that loop forever, never running the rest of your code. To avoid this, you can use the “spawn” function. The spawn function takes another function and runs it in a different thread, which prevents it from interrupting the rest of your script. Here is how you can use it (replace the while loop with this):

spawn(function()
	while task.wait() do
		-- The code in the original loop
	end
end)

I hope this is helpful.

Ok thank you for the support. It works. But now there’s another problem, again.

It only shows Player 2 in Player 2’s side, while Player 1 see’s Player 2 and Player 1.

Here’s an example, for more explanation:

It might be easy to solve, but it’s okay. By the way, don’t mind the toolbox. (the topic changed)

New script:

game.Players.PlayerAdded:Connect(function(player)
for i, Players in pairs(game.Players:GetPlayers()) do
if Players:IsA(“Player”) then
local template = game.StarterGui.Template:Clone()
template.Parent = Players.PlayerGui:WaitForChild(“Players”).CharactersFrame
template.Profile.NameForPlayer.Text = player.DisplayName
template.Name = Players.Name
template.Visible = true
print(template.Parent)
local userId = Players.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size100x100
local content, isReady = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
– Set the ImageLabel’s content to the user thumbnail
local imageLabel = template:WaitForChild(“Profile”)
imageLabel.Image = content
imageLabel.Size = UDim2.new(0, 100, 0, 100)
local leaderstats = Instance.new(“Folder”)
leaderstats.Parent = player
leaderstats.Name = “leaderstats”
local Damage = Instance.new(“IntValue”)
Damage.Parent = leaderstats
Damage.Name = “Damage”
template:WaitForChild(“Profile”):WaitForChild(“Damage”).Text = Damage.Value
Damage.Changed:Connect(function()
template:WaitForChild(“Profile”):WaitForChild(“Damage”).Text = Damage.Value
spawn(function()
while task.wait() do
player.Character.Humanoid.Died:Connect(function()
player.leaderstats.Damage.Value = 0
template:WaitForChild(“Profile”):WaitForChild(“Damage”).Text = “Died”
template:WaitForChild(“Profile”):WaitForChild(“Damage”).TextColor = BrickColor.new(1, 0, 0.0156863)
game.SoundService[“Glass Break 2”]:Play()
wait(0.9)
template:WaitForChild(“Profile”):WaitForChild(“Damage”).TextColor = BrickColor.new(1, 1, 1)
template:WaitForChild(“Profile”):WaitForChild(“Damage”).Text = player.leaderstats.Damage.Value
end)
end
end)
end)
end
end
end)