I have a script for when the player joins, they are moved to their zone, but face the wrong direction. I use :MoveTo, and I don’t believe it has an orientation property. I believe :PivotTo or CFrame.lookAt could be used, but I am not familiar with either of them. Right now, the player spawns in correctly and at the correct part, but they face to the left.
Here is the code:
local ServerScriptService = game:GetService("ServerScriptService")
local Manager = require(ServerScriptService.PlayerData.Manager)
local Zones = game:GetService("Workspace").Zones
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid")
task.wait()
char:MoveTo(Zones[player:WaitForChild("leaderstats"):WaitForChild("Zone").Value].Position)
print("s")
hum.Touched:Connect(function(hit)
if tonumber(hit.Name) == player:WaitForChild("leaderstats"):WaitForChild("Zone").Value + 1 then
Manager.IncreaseZone(player)
end
end)
end)
end)
I’m going to do a quick rundown on PivotTo because I’m pretty sure it’ll fix this issue
To use PivotTo you’ll want to start with the PrimaryPart of a model if you don’t have one set by default. The Primary part on R6 characters is the Head so we’ll need to add a vertical offset because I think it might get stuck otherwise.
It turns the player upside down initially, and since it’s on the head, it sometimes turns the right direction, but sometimes the wrong direction. Is there a way to do the rotation with CFrame?