basicous
(basicous)
July 21, 2023, 4:36pm
#1
I’m attempting to teleport a target directly in front of the player using :PivotTo(), but they spawn somewhat in the air. How can I fix this?
target:PivotTo(CFrame.lookAt(callerHumanoidRootPart.CFrame * Vector3.new(0,0,-5), callerHumanoidRootPart.Position))
This is running on the server.
Try changing
callerHumanoidRootPart.CFrame * Vector3.new(0,0,-5)
to
(callerHumanoidRootPart.CFrame * CFrame.new(0,0,-5)).Position
basicous
(basicous)
July 21, 2023, 4:48pm
#3
doesn’t seem to be working either
Could you show me how it looks like?
basicous
(basicous)
July 21, 2023, 5:00pm
#5
You could do something like this – although :GetModelCFrame() is considered deprecated, it still works.
local A = workspace.A
local B = workspace.B
local CF = workspace.B:GetModelCFrame()*CFrame.new(0,-B:GetExtentsSize().Y/2,0)
workspace.A:PivotTo(CF * CFrame.new(0,0,-5)*CFrame.Angles(0,math.rad(180),0))
Result:
workspace.B:PivotTo(workspace.A:GetPivot() * CFrame.new(0, 0, -5) * CFrame.fromOrientation(0, math.pi, 0))
Aah – I didn’t realize GetPivot() was a method, much better!
system
(system)
Closed
August 4, 2023, 5:07pm
#9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.