How do i clone gui only once for each player in game

would it show every players name? And wouldn’t it run only once?

it would run for each player silly

No anything done on the client does not replicate to the server, if you want something to replicate to all the clients you either

  1. Change something in a replicated container on the server (e.g. workspace)
  2. Fire a RemoteEvent and use :FireAllClients

i tried that, but it didn’t work. It only showed their own name not everyones

game.Players.PlayerAdded:Connect(function(player)
	Remotes.ShowForAllClients:FireAllClients(player)
end)
RP.Remotes.ShowForAllClients.OnClientEvent:Connect(function()
	local newTemplate = tradingTemplate:Clone()
	newTemplate.Parent = script.Parent
	newTemplate:WaitForChild("playerName").Text = player.Name
end)

yea I can see where you messed up with this :joy:
ill let elon explain this

If you are making an overhead Gui (like a billboard Gui in the workspace), in this case it makes the most sense to do it on the server.

anyway I'll tell you what's wrong with the code

On the client script you posted you don’t take into account the player object that gets passed through the RemoteEvent, you want to place the GUI in each player character.

RP.Remotes.ShowForAllClients.OnClientEvent:Connect(function(player)
	local newTemplate = tradingTemplate:Clone()
	newTemplate.Parent = player.Character -- 
	newTemplate:WaitForChild("playerName").Text = player.Name
end)

For this case I would do

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        -- put a billboardGui in Player.Character
        local billboard = ReplicatedStorage.template:Clone()
        billboard.Parent = player.Character
    end)
end)

Even though it’s technically handling a GUI on the server, I still think it’s better because the server replicates the workspace anyway.

maybe a pro will come and say I’m wrong but I don’t think so

No because if a player joins it fires the function again

Um I don’t think you are fully up to date on the situation. We are talking about a local script.


@NotZylon refer to my last post


lol

it’s not a billboardgui though, it’s just a frame

I already knew that hehehehehehe

Well then do it however you like,

Overhead GUI’s are usually billboard gui’s (I think they always are)


@D0RYU pog

Oh ok sorry just got here lol my bad man

nothing to be sorry for
if ur busy then ur busy

(Cant like need to wait 1 hour lol)

but im not sure what i did wrong

Can you send the code so I can see it?

wait what is the current script or scripts you are using for it rn

RP.Remotes.ShowForAllClients.OnClientEvent:Connect(function()
	local newTemplate = tradingTemplate:Clone()
	newTemplate.Parent = script.Parent
	newTemplate:WaitForChild("playerName").Text = player.Name
end)
game.Players.PlayerAdded:Connect(function(player)
	Remotes.ShowForAllClients:FireAllClients(player)
end)

what do you mean by that

Is their any errors in the output?