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

How do you create a GUI that will disappear when a certain amount of players join?

Asked by 5 years ago

I don't know how to add a script to a GUI/Frame that makes the GUI/Frame become invisible when 4 players join the server. Is there any way to code this?

2 answers

Log in to vote
0
Answered by 5 years ago

Just make an intvalue in replicated storage or serverstroage, and each time a player is added, then add +1 to the intvalue, and after the intvalue is = to 4, then disable the gui, from the clients "PlayerGui"

Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

JuuzouBlitz isnt right. An unnecessary IntValue is within. Use a much quicker, and most likely much better system. I dont know what your usage is exactly, but ill place a part in the script to show the gui again when the players amount is less then 4.

Make sure its placed in the ScreenGui of the gui, and is a localscript.

-- SERVICE --
local runService= game:GetService("RunService")

-- VARIABLES --
local gui= script.Parent --Get our bad boy.
local showAtPlayers= 4 --Show gui at this number of players

-- INIT --
runService.Heartbeat:connect(function(step)
    if #game.Players:GetPlayers()>=showAtPlayers then
        gui.Enabled= false
    else
        gui.Enabled= true
    end
end)


EDIT: Flipped the true and false for enabled...

Answer this question