So I have been trying to clone a gui into PlayerGui for all the players in the server but the gui won't show up where I want it to be.. I have made a script that fires by a remote event. Here is the script:
for _, player in pairs(game.Players:GetPlayers()) do local playerGui = player.PlayerGui local clone = game.Workspace.StatusGui clone.Parent = PlayerGui end
A couple of things: First, relocate where you store the Gui. Don't put it in workspace, some place like "Replicated Storage" will do nicely.
SERVER SCRIPT: write this block of code wherever it should be executed. Use a remote event.
remote_to_invoke = game.ReplicatedStorage.REMOTE_INSTANCE gui_instance = game.ReplicatedStorage.GUI_INSTANCE -- Invoke to all players remote_to_invoke:FireAllClients(gui_instance.Name)
You may be able to use the instance directly but I haven't tested. For now, this script set will look for the instance by its name inside of ReplicatedStorage.
remote_to_listen = game.ReplicatedStorage.REMOTE_INSTANCE player = game.Players.LocalPlayer function attachGUI(gui_name) gui_instance = game.ReplicatedStorage:FindFirstChild(gui_name) if gui_instance then -- Replicate the gui into the players GUI gui_instance :Clone().Parent = player.PlayerGui else print("Unable to find local copy of GUI '" .. gui_name .. "'") end end remote_to_listen.OnClientEvent:Connect(attachGUI)
Basically, it will listen to the remote being invoked, check through replicated storage for the gui name which was provided when invoking the client. Then either print an error message or replicate the GUI into player GUI