So I was working with my builder on our game project. He built a zipline model and I need help on how to script a working zipline. My builder hopes the characters using the zipline is animated though.
I don’t know what is the best way of scripting a zipline. That’s my problem
I have tried using BodyForce but without success. I know it might be the wrong way of doing that.
Mods say I should do my research before I post, so I tested my script this time. Ok so here’s how to use it. Create a server script, a part named “PartA”, and a part named “PartB”. Once you make those three, group them. Now, position PartA’s center point one stud below the high end of the zipline (or the starting end), also do the same for PartB on the end point. Finally, put this in the script:
local a = script.Parent.PartA
local b = script.Parent.PartB
a.Anchored = true
b.Anchored = true
a.CanCollide = false
b.CanCollide = false
a.Touched:connect(function(hit)
local character = hit.Parent
if character:FindFirstChildOfClass("Humanoid") then
local v = Instance.new("RocketPropulsion")
local g = Instance.new("BodyGyro")
v.MaxThrust = 4000
v.MaxSpeed = 30 -- Set to whatever you like.
v.TargetRadius = 0
--v.MaxTorque = Vector3.new(400000, 400000, 0)
local root = character:FindFirstChild("HumanoidRootPart")
if root == nil then
return
end
root.Anchored = true
character:MoveTo(Vector3.new(a.Position.X, a.Position.Y - (root.Size.Y * 0.75), a.Position.Z))
v.Target = b
local head = character:FindFirstChild("Head")
if head == nil then
return
end
g.Parent = head
v.Parent = head
root = character:FindFirstChild("HumanoidRootPart") --repeating again just to check if it still exits
if root == nil then
return
end
local humanoid = character:FindFirstChild("Humanoid")
if humanoid == nil then
return
end
v:Fire()
humanoid.PlatformStand = true
root.Anchored = false
repeat
wait()
until (b.Position - root.Position).magnitude <= 5 --The 5 is how many studs away from part b before it stops.
humanoid.PlatformStand = false
v:Remove()
g:Remove()
end
end)
There’s no animation yet, but I’m sure you can add that your self. It’s also a bit iffy with the rotation but if you play around with it enough, you should get it right.