I want to create a script, which when “Activate”, it takes a GUI from the server storage and clones it in the player’s playergui / startergui without the player having to reset.
Did Anyone know how to do that?
Thank you.
I want to create a script, which when “Activate”, it takes a GUI from the server storage and clones it in the player’s playergui / startergui without the player having to reset.
Did Anyone know how to do that?
Thank you.
PlayerGui
can be referenced from regular scripts, let’s assume you already have a player instance set up, what you can do is simply
local playerGui = Player.PlayerGui -- or Player:WaitForChild("PlayerGui") if it's instant when player joins
toCloneGui:Clone().Parent = playerGui
Where Player
is the variable holding your player instance and toCloneGui
is the variable holding the ScreenGui that needs to be cloned
Ok, could you also tell me how to define “Player” because I can’t really find the solution
Defining it depends on what you’re trying to do, if you’re trying to do something when say, a palyer clicks a clickdetector, MouseClick
gives the player for you to use.
Although it’s different depending on the contexr
what I’m doing is a live event, it is basically a serverscript, with the list of all the things to do.
so i want when it is read, to clone the gui it clones it in the playergui of all the people on the server without them resetting.
Just loop through all the players.
local PLR_SERVICE = game:GetService("Players")
for i, plr in ipairs(PLR_SERVICE:GetPlayers()) do
local gui = plr.PlayerGui
-- do something with it
end
Thank you @FactorOfTheThird working good!
Thank you too @EmbatTheHybrid