I’m making a teleport system. It works but however I want make the character orientation to face the orb it is teleporting at. The character’s orientation doesn’t change at all in the code right now. I tried humanoid.MoveDirection but it always stays at Vector3(0,0,0). How would I make the player face the orb it is teleporting at?
Code:
local function LerpChar(Char, Part)
for i = 0,1,0.05 do
Char.HumanoidRootPart.CFrame = Char.HumanoidRootPart.CFrame:Lerp(Part.CFrame, i)
wait(0.05)
end
end
local function ChangeVisible(Part)
for _,Orb in pairs(workspace:GetDescendants()) do
if Orb.Name == "Orb" and Orb ~= Part then
Orb.Transparency = 0
elseif Orb == Part then
Orb.Transparency = 0.8
end
end
end
for _,v in pairs(workspace:GetDescendants()) do
if v:IsA("BasePart") and v.Name == "Orb" then
local ClickDetector = v.ClickDetector
ClickDetector.MouseClick:Connect(function(plr)
local plrChar = plr.Character
plrChar.HumanoidRootPart.Anchored = true
LerpChar(plrChar, v)
ChangeVisible(v)
end)
end
end
Explorer:
