Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The button turns on when all the players on the server are standing on it?

Asked by 2 years ago

I need to make a button that will count the players who are standing on it. And separately output all the players on the server to a variable. So that if all the players on the server are on the button and the number is equal to all the players on the server, then another script is played

example



local plrmaxs = game.Lighting.enemies.plrmax local plrmin = game.Lighting.enemies.plrmin local status = game.Lighting.statusvalue local mouse = player:GetMouse() game.Players.PlayerAdded:Connect(function() plrmaxs.Value = plrmaxs.Value+1 end) game.Players.PlayerRemoving:Connect(function() plrmaxs.Value = plrmaxs.Value-1 end) function onTouch(part) wait() plrmin.Value = plrmin.Value+1 end function endTouch(part) wait() plrmin.Value = plrmin.Value-1 end if plrmin.Value >= plrmaxs.Value then print("RESTART") wait(3) status.Value = "NEED TO TRY AGAIN. RESTART" game.Workspace.Zat:ClearAllChildren() else wait() end script.Parent.Touched:connect(onTouch) script.Parent.TouchEnded:connect(endTouch)

Answer this question