Trying to get the player to teleport to the part, doesn’t error or do anything.
for i = 1,#playerspawns do
if playerspawns[i].Taken.Value == false then
playerspawns[i].Taken.Value = true
char.HumanoidRootPart.CFrame = CFrame.new(playerspawns[i].Position)
break
else
print("too bad")
end
end
Have you tried SetPrimaryPartCFrame? Maybe, for some reason, CFraming the HumanoidRootPart isn’t moving the character.
Keep in mind the primary part of the character is usually the head (IIRC). So you might want to do CFrame.new(playerspawns[i].Position) * CFrame.new(0, 6, 0).
Additionally, try adding a print before the break to see if the CFrame is actually being set. Make sure your code is executing before you get confused about why it isn’t doing anything.
i tested your code in a example setup and From everything that i can see the snippet you shared should work and if the print that you placed above break prints, then i’m not sure why it isn’t working . which leads me to believe something else is to blame, Could you possibly provide more of your script?
local playerspawns = workspace:WaitForChild("PlayerSpawns"):GetChildren()
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
player.Character.Humanoid.WalkSpeed = 0
player.Character.Humanoid.JumpPower = 0
for i = 1,#playerspawns do
if playerspawns[i].Taken.Value == false then
playerspawns[i].Taken.Value = true
char.HumanoidRootPart.CFrame = CFrame.new(playerspawns[i].Position)
print("hello mate")
break
else
print("too bad")
end
end
end)
end)
i figured it out i think, it’s not working because you are trying to set the character’s cframe too early, so try yeilding/waiting before setting char.HumanoidRootPart.CFrame