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 give a gui to all players when a button is clicked?

Alright, basically I want a script where when I click on a button with a clickdetector in it, a GUI is given to all players for a few seconds, then removed. I do not really know how to script with GUIs, so I can't give any code I have used. If anyone knows how this could be done, please leave a response, it would be appreciated. Thanks, Jhun

3 comments

0

You say it's a button but that it has a click detector in it so is it a TextButton or a Part that the player is going to click?

0

A part that a player is going to click.

0

Should've said that, in ROBLOX when you're saying button, it's gonna be thought of as a TextButton my dude.

1 answer

✓ Accepted answer
local clickDetector = part.ClickDetector
clickDetector.MouseClick:connect(function()
	local guis = {}
	for i,v in pairs(game.Players:GetChildren())do
		local gui = ScreenGui:Clone()
		table.insert(guis, gui)
		gui.Parent = v.PlayerGui
	end
	wait(5)
	for i,v in ipairs(guis) do
		v:Destroy()
	end
end)

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