I want GameScript, SithTeamChecker and JediTeamChecker to be enabled when the number of players in the server is 2 or above and if there is only 1 player in the server, the scripts are disabled.
NumberOfPlayers = game.Players.NumPlayers GameScript = game.Workspace.GameScripts.GameScript SithTeamChecker = game.Workspace.GameScripts.SithTeamChecker JediTeamChecker = game.Workspace.GameScripts.JediTeamChecker while NumberOfPlayers == 0 or 1 do GameScript.Disabled = true SithTeamChecker.Disabled = true JediTeamChecker.Disabled = true end
Would this script do this?
Thanks.
There are several issues with this script, for starters game.Players.NumPlayers will only return the current amount of players when you call this to a variable meaning that the NumberOfPlayers will never change. This can easily be solved, also your while loop is a little funky. Rather then using or, you could just use greater than or less than signs. Here is an example of how I would write your code:
GameScript = game.Workspace.GameScripts.GameScript SithTeamChecker = game.Workspace.GameScripts.SithTeamChecker JediTeamChecker = game.Workspace.GameScripts.JediTeamChecker while game.Players.NumPlayers <= 1 do GameScript.Disabled = true SithTeamChecker.Disabled = true JediTeamChecker.Disabled = true end
Other then that, I don't see any other major issues. I don't really find your method of managing scripts like this as very efficient but I shall not question your work. If you have any other issues, or questions feel free to ask me at any time!
If this answer helped, make sure to like it and click "Accept Answer" so other users with the same issue can find an answer fast!