I’m currently having an issue when trying to spawn players based on ‘Stages’. The player will always spawn facing the same direction. What I’m aiming to do is spawn the player whichever direction X face is facing on the part. Is this possible?
Code:
game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new(“Folder”, Player)
leaderstats.Name = “leaderstats”
local Checkpoint = Instance.new("IntValue", leaderstats)
Checkpoint.Name = "Checkpoint"
Checkpoint.Value = 1
Player.CharacterAdded:Connect(function(Character)
repeat wait() until Player.Character ~= nil
local checkpoint = workspace.Checkpoints:FindFirstChild(Checkpoint.Value)
Character:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(checkpoint.Position + Vector3.new(0,2,0))
end)
Actually CFrame.lookAt(Position,PositionToLookAt) is better. Position needs to be the Character’s PrimaryPart Position and PositionToLookAt needs to be the next stage’s spawn position. With the result set Character:SetPrimaryPartCFrame(Result)