Heres my code
local Pos1 = script.Parent.Parent.Parent.Parent.ElevatorPart.Ma.Position.X + 0.1
local Pos2 = script.Parent.Parent.Parent.Parent.ElevatorPart.Ma.Position.Z+ 3
plr.Character.Humanoid:MoveTo(Vector3.new(Pos1, 19.133, Pos2))
plr.Character:WaitForChild("Humanoid").MoveToFinished:Connect(function()
local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local tween = game:GetService("TweenService"):Create(plr.Character.PrimaryPart, tweenInfo, {CFrame = CFrame.Angles(0, 0,0)}) -- teleport plr on CFrame.new(0,0,0)
tween:Play()
end)
CZXPEK
(czo)
July 14, 2024, 10:13am
#2
CFrame = plr.Character.PrimaryPart.CFrame * CFrame.Angles()
2 Likes
I gather you simply want to modify the rotation. Change the orientation instead of CFrame.Angles
local Pos1 = script.Parent.Parent.Parent.Parent.ElevatorPart.Ma.Position.X + 0.1
local Pos2 = script.Parent.Parent.Parent.Parent.ElevatorPart.Ma.Position.Z+ 3
plr.Character.Humanoid:MoveTo(Vector3.new(Pos1, 19.133, Pos2))
plr.Character:WaitForChild("Humanoid").MoveToFinished:Connect(function()
local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local tween = game:GetService("TweenService"):Create(plr.Character.PrimaryPart, tweenInfo, {Orientation = Vector3.new(0,0,0)}) -- teleport plr on Orientation (0,0,0)
tween:Play()
end)
Its much simpler
When I using Vector.new(0,0,0) orientation of plr. ghm. On client - it good, on server - no. Initially, I already had such a code and I decided to rewrite it, because f
or others plr orientation bugged
Thank you. This helped, but I also ran into the problem that CFrame(0,0,0) kind of adds 0 degrees to the HRP, but I want it not to “add”, but completely change it to 0?
CZXPEK
(czo)
July 14, 2024, 11:43am
#6
sorry for late response but this should work
CFrame = CFrame.new(plr.Character.PrimaryPart.Position) * CFrame.Angles()