The goal of this code is two get two players, and give them the "teamValue" of either "Vip" or "Sniper" and then put the rest onto there own area.
The problem is that who ever is designated as "Sniper" will also get teleported to the spawn pads with the rest of the players, which breaks the system, and then another player wont get teleported at all, and is stuck in the lobby area.
local Players = game:GetService('Players')
while wait() do
local players = game:GetService('Players'):GetPlayers()
if #players >= 3 then
wait(30)
local vip = table.remove(players,math.random(#players))
local sniper = players[math.random(#players)]
vip.Values:WaitForChild('teamValue').Value = 'Vip'
local t = vip.Character:FindFirstChild("Torso")
local h = vip.Character:FindFirstChild("Head")
if vip.Character and vip.Character.Torso then
t.CFrame = game.Workspace:WaitForChild('Spawns').VipSpawn.CFrame + Vector3.new(0,3.2,0)
end
sniper.Values:WaitForChild('teamValue').Value = 'Sniper'
local t = sniper.Character:FindFirstChild("Torso")
local h = sniper.Character:FindFirstChild("Head")
if sniper.Character and sniper.Character.Torso then
t.CFrame = game.Workspace.Spawns.SniperSpawn.CFrame + Vector3.new(0,3.2,0)
end
for k,v in pairs(players) do
if v.Character and v.Values and not v.Values.teamValue == 'Vip' or 'Sniper' then
local t = v.Character:FindFirstChild('Torso')
if t then
t.CFrame = game.Workspace.Spawns.GuardSpawn['GuardSpawn'..k].CFrame + Vector3.new(0,3.2,0)
end
end
end
wait(100)
end
end
Thanks

1 comment
So dont put not for the first one?