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

How do I clone a gui and put it in everybody's playerGui?

Asked by 3 years ago

I'm still making that announcement system, and I still need a lot of help. While testing, my announcement system works, but only on the client. I still have no idea how to do this and remote events still don't work for me. Any help? Here's my script again. (Localscript)

script.Parent.MouseButton1Up:Connect(function()
    local set = script.Parent.Parent.Set
    local text = set.Text
    local label = script.Parent.Parent.Parent.Parent.Announcement.TextLabel.TextLabel
    local frame = script.Parent.Parent
    local ammount = script.Parent.Parent.Time.Text

    frame:TweenPosition(
        UDim2.new(0.5,0,0.6,0), --ending position
        "Out", --how it eases
        "Quad", --styleeee
        0.7, --the time it takes
        false --wont override anything else
    )

    label.Text = text
    label.Parent:TweenPosition(
        UDim2.new(0.5,0,0.1,0),
        "Out",
        "Quad",
        1,
        false
    )
    wait(ammount)
    frame:TweenPosition(
        UDim2.new(0.5,0,0.5,0),
        "Out",
        "Quad",
        0.7,
        false
    )
    label.Parent:TweenPosition(
        UDim2.new(0.5,0,-1.1,0),
        "In",
        "Quad",
        1,
        false
    )
end)

Here is video of me using it: https://www.youtube.com/watch?v=2Kwji4Xk7zY&feature=youtu.be

1 answer

Log in to vote
0
Answered by
RAFA1608 543 Moderation Voter
3 years ago
Edited 3 years ago

First, you got to iterate (go past) every player. To do this, I use a for loop.

--serverscript I guess
local gui --Consider this a GUI. It is nil, because it is a example.
for i,v in pairs(game.Players:GetChildren()) do
    --i as in the index,
    --v as in the value (in this case, the player)
    local cloned = gui:Clone()
    cloned.Parent = v.PlayerGui --where all guis from a player sit at
end

If you have any questions, I can answer them for you.

0
Hah! Thank you! I've actually been kind of scared of for loops from not know how they work and what they do, but now I understand! I just added part of my main script to a for loop and it finally works! Thanks! AviaCheddar 41 — 3y
0
no progle RAFA1608 543 — 3y
Ad

Answer this question