How would I spawn balls in every 200 seconds instead of saying if minutes == 200 etc etc
Here is the script:
for minutes=1, 400 do
timer.Text = "Timer: " .. minutes
status.Text = ""
if minutes == 200 then
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
end
game.ServerStorage.Balls:Clone().Parent = workspace
status.Text = "Half Time"
resetBall(60)
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
game.Workspace.Balls:Destroy()
end
end
if minutes == 400 then
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
end
game.ServerStorage.Balls:Clone().Parent = workspace
status.Text = "Full Time"
resetBall(60)
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
game.Workspace.Balls:Destroy()
end
end
wait(minuteLength)
end
Use the modulo operator, it returns the remainder from a division, in this case we’re checking if when diving “i” by 200 the remainder is 0.
for minutes=1, 400 do
timer.Text = "Timer: " .. minutes
status.Text = ""
if minutes % 200 then
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
end
game.ServerStorage.Balls:Clone().Parent = workspace
status.Text = "Half Time"
resetBall(60)
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
game.Workspace.Balls:Destroy()
end
end
if minutes == 400 then
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
end
game.ServerStorage.Balls:Clone().Parent = workspace
status.Text = "Full Time"
resetBall(60)
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
game.Workspace.Balls:Destroy()
end
end
wait(minuteLength)
end
for minutes=1, 400 do
timer.Text = "Timer: " .. minutes
status.Text = ""
if 200 % minutes == 0 then
print("HI")
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
end
game.ServerStorage.Balls:Clone().Parent = workspace
status.Text = "Half Time"
resetBall(60)
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
game.Workspace.Balls:Destroy()
end
end
if minutes == 400 then
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
end
game.ServerStorage.Balls:Clone().Parent = workspace
status.Text = "Full Time"
resetBall(60)
for index, player in next, playersService:GetPlayers() do
player:LoadCharacter()
game.Workspace.Balls:Destroy()
end
end
wait(minuteLength)
end