I am trying to make a zipline and tween the character’s position to the zipline’s end, and I’m using HRP.Position. I’ve heard that you should you CFrame instead of Position, and I wanna do that. Let me show you the differences:
(Position)
(CFrame)
Script
StartPrompt.Triggered:Connect(function(Player)
if CharacterValue.Value then return end
StartPrompt.Enabled = false
EndPrompt.Enabled = false
local Character = Player.Character
CharacterValue.Value = Character
local Humanoid = Character.Humanoid
local Animator = Humanoid.Animator
local HRP = Character.HumanoidRootPart
local ZipAnim
local Distance = (Character.HumanoidRootPart.Position - EndZip.NeonCore.Position).Magnitude
local Time = Distance / 25
local Diff = 5
HRP.CFrame = CFrame.new(StartPrompt.Parent.WorldPosition + Vector3.new(0,Diff,0))
HRP.CFrame = CFrame.lookAt(HRP.Position,EndPrompt.Parent.WorldPosition + Vector3.new(0,Diff,0))
local Tween = TweenService:Create(
HRP,
TweenInfo.new(
Time,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
),
{
--Position = EndPrompt.Parent.WorldPosition + Vector3.new(0,Diff,0)
CFrame = CFrame.new(EndPrompt.Parent.WorldPosition + Vector3.new(0,Diff,0)),
}
)
HRP.Anchored = true
if Humanoid.RigType == Enum.HumanoidRigType.R15 then
ZipAnim = Animator:LoadAnimation(ReplicatedStorage.Animations.ZipLine.AnimR15)
elseif Humanoid.RigType == Enum.HumanoidRigType.R6 then
ZipAnim = Animator:LoadAnimation(ReplicatedStorage.Animations.ZipLine.AnimR6)
end
Tween:Play()
ZipAnim:Play()
Tween.Completed:Wait()
ZipAnim:Stop()
HRP.Anchored = false
CharacterValue.Value = nil
StartPrompt.Enabled = true
EndPrompt.Enabled = true
end)
while wait() do
local vector3one = script.Parent.Position
local vecot3two = workspace["L85A2 Stock"].Body.Position
local cframe = CFrame.new(vector3one, vecot3two)
script.Parent.CFrame = cframe
end
above is the script, below is the visual that came from the results of the script