Hooks with Orbit

Hello, i have been working on hooks system (working by pressing E & Q) the hooks is based on the Algin Position object and it working fine, the problem is that when the hook draging me into the targeted point i can’t do orbit. i have tried many scripts about orbit but they crashing the player into walls and its buggy. so is it somone who can tell me if i should change the Algin Position with something else and how can i fix the orbit.

sketch

Here is some examples for how i want it for people who didn’t understud me


There is not much to see in the script. It creates the part where the mouse is located and then creates an attachment between the part and the player
`
local using = false

---------- EHook ---------
script.Parent.Events.HookE.OnServerEvent:Connect(function(plr, char, mouse, target)

local RShootingP = char.Gear.GassGear.MetalPart.RightShootingP
	
if target == nil then 
elseif target:IsA("BasePart") then
	
using = true
local hitpart = Instance.new("Part")
hitpart.Name = "EHitPart"
hitpart.Anchored = true
hitpart.CanCollide = false
hitpart.BrickColor = BrickColor.new("Fossil")
hitpart.Size = Vector3.new(0.1,0.1,0.1)
hitpart.Material = Enum.Material.SmoothPlastic
hitpart.Transparency = 0
hitpart.Parent = RShootingP
hitpart.Position = mouse.Position
	
local ea0 = Instance.new("Attachment")
ea0.Name = "EA0"
ea0.Parent = RShootingP
	
local ea1 = Instance.new("Attachment")
ea1.Name = "EA1"
ea1.Parent = hitpart
	
local beam = Instance.new("Beam")
beam.Color = ColorSequence.new(Color3.fromRGB(0,0,0))
beam.Transparency = NumberSequence.new(0,0)
beam.Width0 = 0.1
beam.Width1 = 0.1
beam.FaceCamera = true
beam.Attachment0 = ea0
beam.Attachment1 = ea1
beam.Parent = RShootingP
	
local ehook = Instance.new("AlignPosition")
ehook.Name = "EHook"
ehook.Color = BrickColor.new("Really black")
ehook.Attachment0 = ea0
ehook.Attachment1 = ea1
ehook.Parent = RShootingP

-------- EHookEnded -----------
script.Parent.Events.EEnded.OnServerEvent:Connect(function(player, character)
using = false
ehook:Destroy()
hitpart:Destroy()
beam:Destroy()
ea0:Destroy()
ea1:Destroy()

script.Parent.Events.LeftOrbit.OnServerEvent:Connect(function()

local Orbit = game.ServerStorage.ScriptGear.Orbit:Clone()
Orbit.Parent = char.Gear.Hooks

ehook:Destroy()

script.Parent.Events.LeftOrbitEnded.OnServerEvent:Connect(function()
	Orbit:Destroy()

end)
end)
end)
end
end)

---------- QHook --------------
script.Parent.Events.HookQ.OnServerEvent:Connect(function(plr, char, mouse, target)

local LShootingP = char.Gear.GassGear.MetalPart.LeftShootingP

if target == nil then 
elseif target:IsA("BasePart") then

using = true
local hitpart = Instance.new("Part")
hitpart.Name = "QHitPart"
hitpart.Anchored = true
hitpart.CanCollide = false
hitpart.BrickColor = BrickColor.new("Fossil")
hitpart.Size = Vector3.new(0.1,0.1,0.1)
hitpart.Material = Enum.Material.SmoothPlastic
hitpart.Transparency = 0
hitpart.Position = mouse.Position
hitpart.Parent = LShootingP

local qa0 = Instance.new("Attachment")
qa0.Name = "EA0"
qa0.Parent = LShootingP

local qa1 = Instance.new("Attachment")
qa1.Name = "EA1"
qa1.Parent = hitpart

local beam = Instance.new("Beam")
beam.Color = ColorSequence.new(Color3.fromRGB(0,0,0))
beam.Transparency = NumberSequence.new(0,0)
beam.Width0 = 0.1
beam.Width1 = 0.1
beam.FaceCamera = true
beam.Attachment0 = qa0
beam.Attachment1 = qa1
beam.Parent = LShootingP

local qhook = Instance.new("AlignPosition")
qhook.Name = "QHook"
qhook.Color = BrickColor.new("Really black")
qhook.Attachment0 = qa0
qhook.Attachment1 = qa1
qhook.Parent = LShootingP

-------- QHookEnded -----------
script.Parent.Events.QEnded.OnServerEvent:Connect(function(player, character)
using = false
qhook:Destroy()
hitpart:Destroy()
qa0:Destroy()
qa1:Destroy()
end)
end
end)
`

1 Like

It’s unclear what you are trying to acheive, do you think you could show your code and a video of what the hooks system is supposed to look like?