game.Players.PlayerAdded:Connect(function() game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value + 1 if game.ServerStorage.Playernum.Value > 1 then LocalScript.Disabled = false LocalScripte.Disabled = true else LocalScript.Disabled = true LocalScripte.Disabled = false end end) game.Players.PlayerRemoving:Connect(function() game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value - 1 if game.ServerStorage.Playernum.Value > 1 then LocalScript.Disabled = false LocalScripte.Disabled = true else LocalScript.Disabled = true LocalScripte.Disabled = false end end)
--script no1 (enough players) local sutart = 20 for i = sutart,0,-1 do wait(1) script.Parent.Text = i .. " Secconds Reaming" end
--script no 2 (not enough players) while true do script.Parent.Text = "Waiting Players." wait(1) script.Parent.Text = "Waiting Players.." wait(1) script.Parent.Text = "Waiting Players..." wait(1) end
Edit it a bit
local PlayersAmount = game.ServerStorage:WaitForChild("Playernum").Value local Players = game:GetService("Players") local MinigameScript = -- Your Minigame Script local MinigameScript2 = -- Your Minigame Script 2 local function PlayersFunction(Found) if Found == true then PlayersAmount = PlayersAmount + 1 elseif Found == false then if PlayersAmount >= 1 then PlayersAmount = PlayersAmount - 1 end end end local function ToggleMinigame() if PlayersAmount >= 2 then MinigameScript.Disabled = false MinigameScript2.Disabled = true else MinigameScript.Disabled = true MinigameScript2.Disabled = false end end Players.PlayerAdded:Connect(PlayersFunction(true)) Players.PlayerRemoving:Connect(PlayersFunction(false)) PlayersAmount:GetPropertyChangedSignal("Value"):Connect(ToggleMinigame)
Alright So You Made A Few Errors:
game.Players.PlayerAdded:Connect(function() game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value + 1 if game.ServerStorage.Playernum.Value > 1 then LocalScript.Disabled = false LocalScripte.Disabled = true else LocalScript.Disabled = true LocalScripte.Disabled = false end end) game.Players.PlayerRemoving:Connect(function() game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value - 1 if game.ServerStorage.Playernum.Value > 1 then LocalScript.Disabled = false LocalScripte.Disabled = true else LocalScript.Disabled = true LocalScripte.Disabled = false end end)
It Should Be This:
game.Players.PlayerAdded:Connect(function() game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value + 1 if game.ServerStorage.Playernum.Value > 1 then LocalScript.Disabled = false LocalScript.Disabled = true else LocalScript.Disabled = true LocalScript.Disabled = false end end) game.Players.PlayerRemoving:Connect(function() game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value - 1 if game.ServerStorage.Playernum.Value > 1 then LocalScript.Disabled = false LocalScript.Disabled = true else LocalScript.Disabled = true LocalScript.Disabled = false end end)
Next Time Maybe Have A Look In Output For Errors
Closed as Non-Descriptive by evaera
This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.
Why was this question closed?