Been battling this sorta thing for a while. What i have at the moment works… but not well at all. only if they are at the end position or start position does it really hit. if they are in the middle, no chance.
i use a .touch and get parts to detect, so i should probably be using a raycast but ive never touched that stuff.
hb = Instance.new("Part")
hb.Size = Vector3.new(5,5,12)
hb.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,0,-10)
hb.Anchored = false
hb.CanCollide = false
hb.Transparency = 0
hb.Massless = true
hb.Name = "hb"
hb.Material = Enum.Material.ForceField
hb.Color = Color3.new(1, 0, 0)
hb.CanQuery = false
hb.Parent = workspace.Fx
game.Debris:AddItem(hb,0.25)
local con
con = hb.Touched:Connect(function()
con:Disconnect()
end)
local parented = nil
local hits = {}
hb.Touched:connect(function(hit)
for i,v in pairs(hb:GetTouchingParts()) do
if v:IsDescendantOf(character) == false then