Hello, So I am making a third-person shooter game, I've made the round intermission system which gets all children and teleports them to the lobby and the game so how do I give a specific player a role in which the system doesn't teleport him, why you may ask? because if a player doesn't want to play he can click the "menu" button and a Gui pops up and he can configure his stuff or whatever I had the idea of a role or something in which a role is given to a player the system ignores the player with the role, and if the player exits the GUI the role get removes, here is the round system:

--Simple round script by LizardV2

--Each player is placed slightly farther from the last
local m_bIncrementLocations = true
--Teleports all
local m_bTeleportAll = true -- too lazy to work on this

local m_iTimerLength = 10 --Round length in seconds
--Middle time
local m_iBreakTime = 40 --Intermission

Model = script.Parent
ActiveRound = Model.ActiveRound
RoundTime = Model.RoundTime
IntTime = Model.IntermissionTimeLeft

IntTime.Value = m_iBreakTime

function m_fnHandleTimer()
	if (ActiveRound.Value and RoundTime.Value > 0) then
		RoundTime.Value = RoundTime.Value - 1
	end
	if (ActiveRound.Value and RoundTime.Value <= 0) then
		RoundTime.Value = 0
			Model.IntermissionTimeLeft.Value = m_iBreakTime
		ActiveRound.Value = false
		for i, player in ipairs(game.Players:GetChildren()) do
			max = Model.LobbyBricks:GetChildren()
			randomlocation = math.random(1,#max)
			m_fnTeleportTo(max[randomlocation], player, i)
			
		end
	end
end


ActiveRound.Changed:connect(function(NewValue)
    if (ActiveRound.Value == false) then
		while(Model.IntermissionTimeLeft.Value > 0)do
			wait(1)
			Model.IntermissionTimeLeft.Value = Model.IntermissionTimeLeft.Value - 1
		end
		RoundTime.Value = m_iTimerLength
		ActiveRound.Value = true
		Model.IntermissionTimeLeft.Value = 0
		for i, player in ipairs(game.Players:GetChildren()) do
			max = Model.GameBricks:GetChildren()
			randomlocation = math.random(1,#max)
			m_fnTeleportTo(max[randomlocation], player, i)
		end
	end
end)

function m_fnTeleportTo(Part, player, i)
  		if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
			if (m_bIncrementLocations == true) then
     			player.Character.HumanoidRootPart.CFrame = Part.CFrame + Vector3.new(0, i * 5, 0)
			else
				player.Character.HumanoidRootPart.CFrame = Part.CFrame
			end
   		end
end

function m_fnHandleActiveGame()
	if (ActiveRound.Value == true and RoundTime.Value == m_iTimerLength) then
		for i, player in ipairs(game.Players:GetChildren()) do
			max = Model.GameBricks:GetChildren()
			randomlocation = math.random(1,#max)
			m_fnTeleportTo(max[randomlocation], player, i)
			
		end
	end
end

--Run every second
while wait(1) do
	m_fnHandleTimer()
	m_fnHandleActiveGame()
end

1 comment

0

Please don't claim others work as your own. The first line clearly states "--Simple round script by LizardV2" and you said "I've made the round intermission system..." This isn't FreeModelsHelpers, it's ScriptingHelpers. Please understand the code and give an explanation. But anyways, if you're trying to give a role through a gui in a ServerScript. That won't work, it has to be on the client side.