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

How do I give a gui to all players when a button is clicked?

Asked by 6 years ago

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

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? blowup999 659 — 6y
0
A part that a player is going to click. jhunlzeus4 20 — 6y
0
Should've said that, in ROBLOX when you're saying button, it's gonna be thought of as a TextButton my dude. User#18043 95 — 6y

1 answer

Log in to vote
0
Answered by
blowup999 659 Moderation Voter
6 years ago
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)
Ad

Answer this question