I been trying to create something called ODM/3DMG from an anime called Attack on Titan. However, I am struggling on the system someone referred me to, Lineforces.
I’ve parented and assigned a lineforce and it’s attachments, however it just doesn’t work and flops the character. Anyone know why?
--// 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 HandlerVelocity = ServerEvents.RemoteEvents.HandlerVelocity
local grappleSpeed = script.Parent.GrappleSpeed
local velocitySpeed = script.Parent.VelocitySpeed
local driftSpeed = script.Parent.DriftSpeed
--// Functions
local velocity = {}
function camShake()
end
function createVelocity(Parent,Power,Force,Vector,Name)
local VelocityInstance = Instance.new("BodyVelocity")
VelocityInstance.P = Power
VelocityInstance.MaxForce = Vector3.new(Force,Force,Force)
VelocityInstance.Parent = Parent
VelocityInstance.Velocity = Vector
VelocityInstance.Name = Name or "BodyVelocity"
return VelocityInstance
end
function createForce(Parent)
local BodyForce = Instance.new("BodyForce")
BodyForce.Force = Vector3.new()
BodyForce.Parent = Parent
return BodyForce
end
function createGyro(Parent,D,Torque,P,CF,Name)
local Gyro = Instance.new("BodyGyro")
Gyro.D = D
Gyro.MaxTorque = Vector3.new(Torque,Torque,Torque)
Gyro.P = P
Gyro.CFrame = CF
Gyro.Name = Name or "BodyGyro"
Gyro.Parent = Parent
return Gyro
end
function createLineForce(Parent,A0,A1)
local Lineforce = Instance.new("LineForce")
Lineforce.Parent = Parent
Lineforce.Attachment0 = A0
Lineforce.Attachment1 = A1
Lineforce.Magnitude = 1000
Lineforce.ApplyAtCenterOfMass = true
return Lineforce
end
function createAttachment(Parent)
local newAttach = Instance.new("Attachment")
newAttach.Parent = Parent
return newAttach
end
function onLeftVelocity(player,target,TargetParent)
local newAttach = createAttachment(TargetParent)
local char = player.Character
local ODMHolder = char:WaitForChild("ODM").HumanoidRootPart
local leftDetachment = ODMHolder:WaitForChild("LeftDetacher")
local LeftHookPiece = leftDetachment.Primary.HookDetachment
local hum = char:WaitForChild("Humanoid")
hum.PlatformStand = true
local playerAttach = createAttachment(LeftHookPiece)
local newForce = createLineForce(char,newAttach,playerAttach)
print(TargetParent)
end
function onRightVelocity(player,target,TargetParent)
end
local function onClientHandler()
end
local function onServerHandler()
HandlerVelocity.Event:Connect(function(player,target,direction,TargetParent)
if direction == "Left" then
onLeftVelocity(player,target,TargetParent)
elseif direction == "Right" then
onRightVelocity(player,target,TargetParent)
end
end)
end
--// Initialization
local function init()
if runService:IsClient() then
onClientHandler()
elseif runService:IsServer() then
onServerHandler()
end
end
init()
return velocity
What happens: