Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

2 comments

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!

0

no progle

This discussion is preserved as it was. New answers, comments, and votes are closed.