char:FindFirstChild("HumanoidRootPart").CFrame =
CFrame.new(-40.768, -4.781, -46.732) --put position in ()
to
char:FindFirstChild("HumanoidRootPart").CFrame =
CFrame.new(-40.768, -4.781, -46.732)
*CFrame.Angles(0,math.pi,0)
-- times 180 angles on y axis (math.rad(180) is math.pi)
Though, I would recommend using a part facing where you want the player to teleport.
Using CFrame.Angles as Aeventy suggested would definitely work, but for this it seems like a part would be much easier to use and change. If you just insert a part into the workspace, you can get that part’s CFrame (which contains both rotation and position data) and use it as the HRP’s new CFrame, letting you easily change wherever you want the spawn to be!
how would i change my checkpoint script too?
heres the script:
local spawn = script.Parent
spawn.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local checkpointData = game.ServerStorage:FindFirstChild("CheckpointData")
if not checkpointData then
checkpointData = Instance.new("Model", game.ServerStorage)
checkpointData.Name = "CheckpointData"
end
local checkpoint = checkpointData:FindFirstChild(tostring(player.userId))
if not checkpoint then
checkpoint = Instance.new("ObjectValue", checkpointData)
checkpoint.Name = tostring(player.userId)
player.CharacterAdded:connect(function(character)
wait()
character:WaitForChild("HumanoidRootPart").CFrame = game.ServerStorage.CheckpointData[tostring(player.userId)].Value.CFrame + Vector3.new(0, 4, 0)
end)
end
checkpoint.Value = spawn
end
end)