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?
COMMUNITY QUESTION
How do you create a GUI that will disappear when a certain amount of players join?
2 answers
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"
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...
This discussion is preserved as it was. New answers, comments, and votes are closed.
