Round system not working

I put while in the sense that it will loop, The system works but it dosent loop, Can someone help?

while true do
	task.wait()
	game.Players.PlayerAdded:Connect(function(plr)
		local Intermission = 1
		local Round = 1
		local part = script.Parent -- the part that you want to shrink
		local tweenService = game:GetService("TweenService")

		local info = TweenInfo.new(10, Enum.EasingStyle.Linear, Enum.EasingDirection.In) -- duration: 0.5 seconds, linear easing, in-out direction
		local size = Vector3.new(50,20,50)-- the final size of the part (10% of its original size)
		local tween = tweenService:Create(part, info, {Size = size}) -- create the tween
		if Intermission < 2 then
			task.wait(10)
			plr.Character:MoveTo(game.Workspace.Baseplate.Position)
			tween:Play()
			Round = 3
			Intermission = 3
		end
		if Round > 2 then
			task.wait(20)
			part.Size = Vector3.new(500, 20, 500)
			plr.Character:MoveTo(game.Workspace.Lobby.Platform.SpawnLocation.Position)
			Intermission = 1
			Round = 1
		end
	end)
end
1 Like

Loop through every player in the game instead of connecting PlayerAdded for every iteration.

It worked its looping now thank you!

1 Like

You’re continuously firing PlayerAdded event. Try this:

game.Players.PlayerAdded:Connect(function(plr)
    while task.wait() do
        local Intermission = 1
		local Round = 1
		local part = script.Parent -- the part that you want to shrink
		local tweenService = game:GetService("TweenService")

		local info = TweenInfo.new(10, Enum.EasingStyle.Linear, Enum.EasingDirection.In) -- duration: 0.5 seconds, linear easing, in-out direction
		local size = Vector3.new(50,20,50)-- the final size of the part (10% of its original size)
		local tween = tweenService:Create(part, info, {Size = size}) -- create the tween
		if Intermission < 2 then
			task.wait(10)
			plr.Character:MoveTo(game.Workspace.Baseplate.Position)
			tween:Play()
			Round = 3
			Intermission = 3
		end
		if Round > 2 then
			task.wait(20)
			part.Size = Vector3.new(500, 20, 500)
			plr.Character:MoveTo(game.Workspace.Lobby.Platform.SpawnLocation.Position)
			Intermission = 1
			Round = 1
		end
    end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.