I am making an invitation system that when I click accept a ui appears but what is the best way to clone the ui for the 2 players?
do i need to do this?
local UiPlayer = game.ServerScriptService:WaitForChild("Interface").Games[tostring(GameName)]:Clone()
local UiPlayer2 = game.ServerScriptService:WaitForChild("Interface").Games[tostring(GameName)]:Clone()
This will just create new instances of the UI in ServerScriptService.
You need to get the two players and clone the UIs into their PlayerGui.
local player1 = game.Players.Player1 -- replace with actual player
local player2 = game.Players.Player2 -- replace with actual player
local ui = game.ServerScriptService:WaitForChild("Interface").Games[tostring(GameName)]
local uiPlayer1 = ui:Clone()
uiPlayer1.Parent = player1:WaitForChild("PlayerGui")
uiPlayer1.Enabled = true -- enable the ui
local uiPlayer2 = ui:Clone()
uiPlayer2.Parent = player2:WaitForChild("PlayerGui")
uiPlayer2.Enabled = true
Also, I wouldn’t recommend storing UIs in ServerScriptService. SSS is solely for server-side scripts. You can put them in ReplicatedStorage, maybe.