Hey,
I have been trying to figure out for many days, how I can create a similar rope system like the one in the game Altitorture. All my attempts before have been complete failures but now I have gotten some kind of velocity system working. It Isn’t perfect at all and needs lots of improvements. I will provide videos of the current system and one of what it should look like. My current test code is also provided in the end of this post.
My current system:
What it is supposed to be like (Altitortures system):
My current code (This is only test code):
while task.wait() do
if script.Parent:FindFirstChild("HumanoidRootPart") then
local Part1 = script.Parent.HumanoidRootPart
local Part2 = workspace.Part
if not Part1:FindFirstChild("Rope") then
local Attachment = Instance.new("Attachment")
Attachment.Parent = Part1
Attachment.Name = "RopeAttachment"
local Rope = script.Rope:Clone()
Rope.Parent = Part1
Rope.Attachment0 = Attachment
Rope.Attachment1 = Part2.Attachment
end
local directionToPart2 = (Part2.Position - Part1.Position).Unit
local distanceToPart2 = (Part2.Position - Part1.Position).Magnitude
if distanceToPart2 >= 15 then
local nearestPointOnSurface = Part2.Position + directionToPart2 * (Part2.Size.X / 2)
if Part1.Position.Y <= 0 then
local velocity = Instance.new("BodyVelocity")
velocity.MaxForce = Vector3.new(6000, 10000, 6000)
velocity.Velocity = directionToPart2 * (200 * distanceToPart2)
velocity.Parent = Part1
task.wait(.6)
velocity:Destroy()
else
local velocity = Instance.new("BodyVelocity")
velocity.MaxForce = Vector3.new(6000, distanceToPart2, 6000)
velocity.Velocity = directionToPart2 * (200 * distanceToPart2)
velocity.Parent = Part1
task.wait(.6)
velocity:Destroy()
end
end
end
end