Hi, I’m making a zipline for my game, and I’m wondering how I can make the player tilt on the Z axis in the direction of the zipline.
Zipline Code Block:
local Elasped = 0
local Jump = false
local Point
local NextPoint
Character.PrimaryPart = RootPart
while Elasped <= Duration and Jump == false do
local Alpha = math.min(1, Elasped / Duration)
local FixedT = Bezier:GetAdjustedT(Alpha, PointPos)
Point = Bezier:GetBezierPosition(math.clamp(FixedT, 0, 1), unpack(PointPos))
NextPoint = Bezier:GetBezierPosition(math.clamp(FixedT + Step, 0, 1), unpack(PointPos))
local Distance = (Point - NextPoint).Magnitude
Character:PivotTo(CFrame.new(Point, NextPoint) * CFrameOffset)
Elasped += RunService.Heartbeat:Wait()
if Humanoid.Jump and rope:GetAttribute("CanJump") then
Jump = true
end
end
GetBezierPosition Function:
function module:GetBezierPosition(t : number, ... : any) : Vector3
local points = {...}
while #points > 1 do
for i = 1, #points - 1 do
points[i] = lerp(points[i], points[i + 1], t)
end
points[#points] = nil
end
return points[1]
end