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?
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.
01 | -- SERVICE -- |
02 | local runService = game:GetService( "RunService" ) |
03 |
04 | -- VARIABLES -- |
05 | local gui = script.Parent --Get our bad boy. |
06 | local showAtPlayers = 4 --Show gui at this number of players |
07 |
08 | -- INIT -- |
09 | runService.Heartbeat:connect( function (step) |
10 | if #game.Players:GetPlayers()> = showAtPlayers then |
11 | gui.Enabled = false |
12 | else |
13 | gui.Enabled = true |
14 | end |
15 | end ) |
EDIT: Flipped the true and false for enabled...