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!
01 | If (Game.Workspace.Game 1. Players = "1" or "0" ) |
02 | then function MouseClick() |
03 |
04 |
05 | -- Ill add a script here that TP's the player to Game 1 and adds 1 value to Game1.Players |
06 |
07 |
08 |
09 | end |
10 | script.Parent.MouseButton 1 Down:connect(MouseClick) |
1 | function MouseClick() |
2 | wait( 0 ) |
3 | local numplaying = Game.Workspace.Game 1. Players.Value; |
4 | if numplaying = = 0 or numplaying = = 1 then |
5 |
6 | end |
7 | end |
8 | script.Parent.MouseButton 1 Down: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!
01 | function MouseClick() |
02 | wait( 0 ) |
03 |
04 |
05 | if Game.Workspace.Game 1. Players = = ( 1 ) or ( 0 ) then |
06 |
07 |
08 |
09 | end |
10 | end |
11 | script.Parent.MouseButton 1 Down:connect(MouseClick) |
PLEASE TELL ME IF I AM WRONG