Players not teleporting to part Cframe

  1. What do I want to achieve?
    I would like to teleport all the players who are in the team “InGame” To a parts Cframe.

  2. What is the issue?
    Nothing really happens! I dont think there are any errors

  3. What solutions have you tried so far?
    Im not too sure what I could do at this point.

for i,v in pairs(game.Players:GetChildren()) do
					if v.Team == game.Teams["InGame"] then
						v.Character:SetPrimaryPartCFrame(game.Workspace.Lobby.SpawnLocation.CFrame)
					end
				end	

Script is in Server script service.

1 Like

Hello

If its not hard for you can you try this insteed?

for i,v in pairs(game.Players:GetChildren()) do

    local playername = v.Name

    local character = workspace:FindFirstChild(playername)

    local root = character:FindFirstChild("HumanoidRootPart")

    if v.Team == game.Teams["InGame"] then

      root.CFrame = game.Workspace.Lobby.SpawnLocation.CFrame + Vector3.new(0,3,0)

    end

end
2 Likes

Hello :slight_smile: I tried this but it did not work.

local Teams = game:GetService("Teams")

local Part = part

for _, player in ipairs(Teams.InGame:GetPlayers())do
    player.Character.HumanoidRootPart.CFrame = Part.CFrame + Vector3.new(0,3,0)
end