Hey! I been working on something called 3DMG or ODM Gear which is from an anime called Attack on Titan. I’m currently working on the hooking part of it, basically what I mean is, ODM is supposed to move smoothly towards the target position, and only when the hook reaches it, will body velocity occur.
Right now, I am not trying to add any velocity or any movement, I simply want the ODM hooking to work. Aka I just want the hook to move towards the target position, I can figure out the Velocity part.
I been trying to figure this out for a while, and here’s how I want it to work;
Here’s my script for it, at the moment, it doesn’t even Lerp. I’ve been using Lerping as I was recommended Lerping over tweening, however it’s just not working.
--// Variables
local runService = game:GetService("RunService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local Library = replicatedStorage.Initialization.Library
local events = Library.Events
local ClientEvents = events.ClientEvents
local ServerEvents = events.ServerEvents
local RopeEvent = ServerEvents.RemoteEvents.HandlerRope
local rope = {}
--// Functions
function onLeftRope(player,target,inValue)
print("Activate Left Rope")
print(target.Position)
local char = player.Character
local ODMHolder = char:WaitForChild("ODM").HumanoidRootPart
local leftDetachment = ODMHolder:WaitForChild("LeftDetacher")
local LeftHookPiece = leftDetachment.Primary.HookDetachment
local LeftRope = LeftHookPiece.Rope
local LeftReference = leftDetachment.HookReference
local LeftWeld = LeftReference.WeldPart
local distance = (char.PrimaryPart.Position - target.Position).Magnitude
LeftRope.Length = distance
for i = 0,1,.1 do
wait(0.05)
LeftReference.CFrame = LeftReference.CFrame:Lerp(CFrame.new(target.Position),i)
end
end
function onRightRope(player,target,inValue)
print("Activate Right Rope")
print(target.Position)
local char = player.Character
local ODMHolder = char:WaitForChild("ODM").HumanoidRootPart
local rightDetachment = ODMHolder:WaitForChild("RightDetacher")
local RightHookPiece = rightDetachment.Primary.HookDetachment
local RightRope = RightHookPiece.Rope
local RightReference = rightDetachment.HookReference
local RightWeld = RightReference.WeldPart
local newAttach = Instance.new("Attachment")
local distance = (char.PrimaryPart.Position - newAttach.Position).Magnitude
newAttach.Parent = target
newAttach.Position = Vector3.new(target.Position.X,target.Position.Y,target.Position.Z)
RightRope.Attachment0 = RightHookPiece.Attachment0
RightRope.Attachment1 = newAttach
RightRope.Length = distance
for i = 0,1,.1 do
wait()
RightReference.CFrame = RightReference.CFrame:Lerp(CFrame.new(target.Position),i)
end
end
local function onClientHandler()
end
local function onServerHandler()
RopeEvent.Event:Connect(function(player,target,inValue,HookValue)
if HookValue == "Left" then
onLeftRope(player,target,inValue)
elseif HookValue == "Right" then
onRightRope(player,target,inValue)
else
warn("Unexpected Error - Rope")
end
end)
end
local function init()
if runService:IsClient() then
onClientHandler()
elseif runService:IsServer() then
onServerHandler()
end
end
--// Initialization
init()
return rope
Here’s what happens right now;
https://gyazo.com/a9750e1fa3fc3ee0118e106b67ee7c14
Thank you.