Hello Devs!
In my game when the characters spawn they face one direction while the player faces another direction. I earlier had a problem where the character was facing towards an unintended direction after i fixed that the character started spawning in the correct direction but the camera stated facing towards the player.
The script that i use to rotate the player is also the leader stats script of my game which is given below:
local checkpoints = workspace:WaitForChild("Checkpoints")
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local v = Instance.new("IntValue")
v.Name = "Stage"
v.Value = 1
v.Parent = leaderstats
plr.CharacterAdded:Connect(function(char)
local HumanoidRootPart = char:WaitForChild("HumanoidRootPart")
char:MoveTo(checkpoints[v.Value].Position)
task.wait()
HumanoidRootPart.CFrame = checkpoints[v.Value].CFrame + Vector3.new(0, 3.5, 0)
HumanoidRootPart.Touched:Connect(function(hit)
if hit.Parent == checkpoints then
if tonumber(hit.Name) == v.Value +1 then
v.Value = v.Value +1
end
end
end)
end)
end)
Thankyou For Reading