Hello. I'm currently making a main handler script for a game that I'm working on. I tried to test what I have so far and realized it skipped two entire functions, which inside of those functions were the main part of the handler. I have no idea why it skipped them. Inside of the script I linked I put comments on where the skipping starts and then ends.

local player
local ts = game:GetService("TweenService")

function intermissionstuff() --starts skipping here
if #game.Players:GetChildren() < 2 then
		game.ReplicatedStorage.WaitPlayers:FireAllClients()
		while wait(1) do
		if #game.Players:GetChildren() >= 2 then break end
		end
	end
		game.ReplicatedStorage.Intermission:FireAllClients()
		local countdown = 16
		while wait(1) do
			countdown = countdown - 1
			if countdown == 0 then break end
		end
	for i,v in pairs(game.Players:GetChildren()) do
		v.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.TeleportBrick.Position) * CFrame.new(0,4,0)
		v.TeamColor = game:GetService("Teams").Playing.TeamColor
		
		counter = 0
		players = {}
		went = {}
		for i,v in pairs(game.Teams.Playing:GetPlayers()) do
			table.insert(players, v.Name)
		end
	end		
		intermissionstuff()
	
		function roundstuff()
			if #game.Teams.Playing:GetPlayers() == 1 then
				for i,v in pairs(game.Teams.Playing:GetPlayers()) do
					player = v
				end
				game.ReplicatedStorage.WonGame:FireAllClients(player)
				intermissionstuff()
			end		
		counter = counter + 1	
		if not players[counter] then
			counter = 1
				picked = went[counter]
				if game.Players:FindFirstChild(picked) then
				table.remove(went, counter)
					table.insert(players, picked)
				else
					table.remove(went, counter)
					roundstuff()
				end
			elseif players[counter] then
				picked = players[counter]
				if game.Players:FindFirstChild(picked) then
				table.remove(players, counter)
					table.insert(went, picked)
				else
					table.remove(players, counter)
					roundstuff()
				end	
			elseif not went[counter] then
				counter = 1
				picked = went[counter]
				if game.Players:FindFirstChild(picked) then
				table.remove(went, counter)
					table.insert(players, picked)
				else
					table.remove(went, counter)
				roundstuff()
			end
		end
	end
end
--stops skipping here and errors since picked is not defined
game.ReplicatedStorage.CurrentPicker:FireAllClients(picked)

game.ReplicatedStorage.EnableSelection:FireClient(picked)
	
roundstuff()

game.ReplicatedStorage.MakeTween.OnServerEvent:Connect(function(plr, color, number)
	local targetfolder = game.Workspace.Blocks:FindFirstChild(color)
	for i,v in pairs(targetfolder:GetChildren()) do
		if v.SurfaceGui.TextLabel.Text == '<font size="250">'..tostring(number).."</font>" then
			local Info = TweenInfo.new(
				5,
				Enum.EasingStyle.Linear,
				Enum.EasingDirection.Out,
				0,
				false,
				0
			)
			
			local Goals = {
				Size = Vector3.new(204,10,10);
			}
		local Lengthen = ts:Create(v, Info, Goals)
			Lengthen:Play()
		end
		wait(5)
		
		roundstuff()
			
	end
end)

And yes, I did do prints to find this out. I still don't know why this is happening, but my best guess is that maybe I put the function calls in the wrong places? Any help would be appreciated. Thanks!

3 comments

0

Where do you call intermissionstuff?

0

line 28

0

You're calling it within the function scope, that won't execute the instruction set unless you call it elsewhere. You'll also cause it to execute twice.