I need help with this minigame script. This is a script in a GUI button. Im my workspace I have An arena called Game1 and It contains a NumberValue Called Players. I want to make it so that only 2 players can be in Game1 at a time. Thank You for reading my problem!
If (Game.Workspace.Game1.Players = "1" or "0") then function MouseClick() -- Ill add a script here that TP's the player to Game 1 and adds 1 value to Game1.Players end script.Parent.MouseButton1Down:connect(MouseClick)
function MouseClick() wait(0) local numplaying = Game.Workspace.Game1.Players.Value; if numplaying == 0 or numplaying == 1 then end end script.Parent.MouseButton1Down:connect(MouseClick)
We cannot say if something == 1 or 2 then
. We have to be explicit in both comparisons: if something == 1 or something == 2
.
In addition, you need to use the Value
of your NumberValue, not the NumberValue itself.
I think I have found the answer to my problem!
function MouseClick() wait(0) if Game.Workspace.Game1.Players==(1)or (0) then end end script.Parent.MouseButton1Down:connect(MouseClick)
PLEASE TELL ME IF I AM WRONG