I have tried multiplying another UDim2 value to add up when cloning for the next player but it just won’t work.
local players = game:GetService("Players")
local textbutton = game.ReplicatedStorage.TextButton
local position = UDim2.new(0, 0,0.13, 0)
wait(5)
for i, v in pairs(players:GetChildren()) do
print("run")
local tt = textbutton:Clone()
tt.Parent = game.Workspace.Part.SurfaceGui.selectFrame
tt.Position = UDim2.new(0, 0,0.13, 0)
tt.Text = v.Name
end
One way you could do this is to use the :FireAllClients() method using a remote event.
Then you can make the button appear using a local script by calling that remote using OnClientEvent. You won’t need the loop since it’ll activate the Remote Event for all players in the server at the time.
don’t worry about that it is working. I was just trying to ask about how I would clone the textbuton when every player joins and have them in an order. I think I found a solution for the order.
yes I already know about RemoteEvents thanks. I just don’t know about the suggestions. I feel like using a remoteEvent is not useful in this way because I want it server sided not client sided
Well, Guis are replicated from the server to the client so you could use a UIListLayout and clone/delete buttons you need to
kinda like
game.Players.PlayerAdded:Connect(function(player)
for index, value in pairs(game.Players:GetPlayers()) do
local Gui = value.PlayerGui
local GuiButtonClone = --put gui button you need to clone here and :Clone() it
GuiButtonClone.Name = player.Name
GuiButtonClone = Gui.--screengui/frame you want it in
end
end)
game.Players.PlayerRemoving:Connect(function(player)
for i,v in pairs(game.Players:GetPlayers()) do
local Gui = v.PlayerGui
local Button = --put screengui here and :FindFirstChild(player.Name)
if Button then Button:Destroy() end
end
end)
edit:You should also make a function to clone everyone’s name thing to the player who joined, I forgot to do that but it shouldnt be too hard