Advertisement
HowToRoblox

ZiplinesHandler

Jan 28th, 2022
1,702
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local pp = Instance.new("ProximityPrompt", script.Parent:WaitForChild("Start"))
  2. pp.ActionText = "Press E to ride"
  3. pp.ObjectText = "Ziplines"
  4.  
  5.  
  6. local line = Instance.new("Beam", script.Parent.Start)
  7. line.FaceCamera = true
  8. line.Transparency = NumberSequence.new(0)
  9. line.Width0 = 0.2
  10. line.Width1 = 0.2
  11.  
  12. local a0 = Instance.new("Attachment", script.Parent.Start)
  13. local a1 = Instance.new("Attachment", script.Parent.End)
  14.  
  15. line.Attachment0 = a0
  16. line.Attachment1 = a1
  17.  
  18.  
  19. pp.Triggered:Connect(function(plr)
  20.    
  21.     pp.Enabled = false
  22.    
  23.     local hrp = plr.Character.HumanoidRootPart
  24.    
  25.     local ziplineOffset = Vector3.new(0, hrp.Size.Y * 2, 0)
  26.    
  27.     local distance = (script.Parent.Start.Position - script.Parent.End.Position).Magnitude
  28.    
  29.     hrp.Anchored = true
  30.     hrp.CFrame = script.Parent.Start.CFrame - ziplineOffset
  31.    
  32.     wait(0.2)
  33.    
  34.     for i = 0, distance / 3 do
  35.        
  36.         game:GetService("RunService").Heartbeat:Wait()
  37.        
  38.         hrp.CFrame = hrp.CFrame:Lerp(script.Parent.End.CFrame - ziplineOffset, i / distance)
  39.     end
  40.    
  41.     hrp.Anchored = false
  42.     pp.Enabled = true
  43. end)
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement