I tried making a zipline script for my game, but it didn’t work. Can anyone tell me hats wrong?
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Destinations = game:GetService("Workspace").ZiplineCode.DestinationNavigation
local AIZipline = game:GetService("Workspace").ZiplineStructure.MainSeat.ZiplineSeat
local NewPoint = 1
local Speed = 25
local Debounce = false
AIZipline.PrimaryPart = AIZipline.Center
AIZipline:SetPrimaryPartCFrame(AIZipline.Center.CFrame)
function GetTime(Distance, Speed)
local Time = Distance / Speed
return Time
end
function WeldZipline()
for i = 1, #AIZipline:GetChildren() do
if AIZipline:GetChildren()[i] ~=AIZipline.PrimaryPart then
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = AIZipline:GetChildren()[i]
Weld.Part1 = AIZipline.PrimaryPart
Weld.Parent = AIZipline.PrimaryPart
AIZipline:GetChildren()[i].Anchored = false
end
end
end
function AutoZipline()
NewPoint += 1
if not Destinations:FindFirstChild(NewPoint) then
if game:GetService("Workspace").ZiplineStructure.MainSeat.ZiplineSeat:FindFirstChild("SeatWld") then
local Humanoid = game:GetService("Workspace"). ZiplineStructure.MainSeat.ZiplineSeat.Seat.SeatWeld.Part1.Parent:WaitForChild("Humanoid")
local HumanoidRootPart = game:GetService("Workspace"). ZiplineStructure.MainSeat.ZiplineSeat.Seat.SeatWeld.Part1.Parent:WaitForChild("HumanoidRootPart")
game:GetService("Workspace"). ZiplineStructure.MainSeat.ZiplineSeat.Seat.SeatWeld:Destroy()
HumanoidRootPart.CFrame *=CFrame.new(7, 0, 0)
Humanoid.JumpPower = 50
end
else
local NextPoint = Destinations[NewPoint]
local Distance = (AIZipline.PrimaryPart.Position - NextPoint.Position).Magnitude
local Time = GetTime(Distance, Speed)
local TweenInformation = TweenInfo.new(
Time,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local Tween = TweenService:Create(AIZipline.PrimaryPart, TweenInformation, {CFrame =NewPoint.CFrame})
Tween:Play()
Tween.Completed:Wait()
AutoZipline()
end
end
game:GetService("Workspace").ZiplineCode.bindableEvent.ziplineEvent.Event:Connect(function()
WeldZipline()
AutoZipline()
end)
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Character.Humanoid.UseJumpPower = true
end)
end)
There are othr scripts too but this is the part that messed up.