Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

anyway to clone a gui from the server to all clients?

Asked by 5 years ago

im trying to make a announcement thing and i want it to clone a gui from the server to all clients

so if i was to press a button it would clone a gui to every client

2 answers

Log in to vote
0
Answered by
Arkrei 389 Moderation Voter
5 years ago

You can use a for loop! Let me know if you dont understand

for _,v in pairs(game.Players:GetPlayers()) do
    local clone = gui:Clone()
    gui.Parent = v.PlayerGui -- v is the player which is got through the loop
end
0
Wouldn't work with proper FE. Spiritation 0 — 5y
0
ima test it LEWIS1063 6 — 5y
0
Wrong ^. It does work with FE. DeceptiveCaster 3761 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
--server
local announcementThing = Instance.new("RemoteEvent", game.ReplicatedStorage);
announcementThing:FireAllClients()

--client
local function cloneAll()
    local requestedGui = ________________:Clone();
    requestedGui.Parent = game.Players.LocalPlayer.PlayerGui;
end

announcementThing.OnServerEvent:Connect(cloneAll)
0
Wrong. The server is not restricted from dropping clones into the PlayerGui. Not only that, but it can also access what it put in there. Cloning anything on the client is client-side only and does not save to the server. DeceptiveCaster 3761 — 5y
0
My answer would work if you weren't intending on monitoring the gui, but I was assuming this was just a simple announcement for all the clients, then my answer would definitely work. Ergo, my answer is correct in some sense. Please assess what I was actually saying before you give a wee comment. Spiritation 0 — 5y
0
Basing off what you had said, it does make sense, and I know what you were meaning to say. But, using RemoteEvents would reduce player lag, in the correct answer of this thread it wouldn't be such a great idea to have a loop for all players from a serverScript if you were intending to make a full fledged game. Spiritation 0 — 5y
0
Server Lag* Spiritation 0 — 5y

Answer this question