Hitboxes not accurate.
https://reddit.com/link/1tf5aw4/video/08nrs57cbk1h1/player
As you cna see in the video, ive tried making hitboxes however they are super delayed, also i cant add the drag effect because the hitboxes drag behind the player when i do. Heres my code.
`AbilityActive = true`
`local function MakeHitbox(amount, X, Y, Z)`
if lungehit == false then
for i = 0, amount, 1 do
local Hitbox = game.ReplicatedStorage.Hitbox:Clone()
Hitbox.Color = Color3.new(1, 0, 0)
Hitbox.Transparency = 0.8
Hitbox.Parent = game.workspace
Hitbox.Orientation = Player.Character.HumanoidRootPart.Orientation
Hitbox.CFrame = Player.Character.HumanoidRootPart.CFrame
Hitbox.CFrame *= CFrame.new(0, 0, 0)
Hitbox.Massless = true
local Weld = Instance.new("WeldConstraint")
Weld.Parent = Hitbox
Weld.Part0 = Player.Character.HumanoidRootPart
Weld.Part1 = Hitbox
Hitbox.Anchored = false
Hitbox.CanCollide = false
Hitbox.Size = Vector3.new(X, Y, Z)
for _, v in pairs(workspace:GetPartsInPart(Hitbox)) do
if v.Name == "HumanoidRootPart" then
if v.Parent.Name ~= Player.Name then
if v.Parent.Humanoid.Health ~= 0 then
if hitboxhit == false then
hitboxhit = true
lungehit = true
playertodmg = v.Parent
SS.ClickSFX:Play()
Hitbox.Color = Color3.new(0, 1, 0)
end
end
end
end
end
end
end
`end`
`Player.Character.Humanoid.WalkSpeed = 0`
`PlayAnimEvent:FireAllClients(Player, "LungeStart")`
`script.Parent.HumanoidRootPart.LungeStart:Play()`
`task.wait(1)`
`PlayAnimEvent:FireAllClients(Player, "Lunging")`
`script.Parent.HumanoidRootPart.Lunging:Play()`
`LV.MaxAxesForce = Vector3.new(500000, 0, 500000)`
`LV.VectorVelocity = Player.Character.HumanoidRootPart.CFrame.LookVector * 250`
`LV.Enabled = true`
`for i = 1.5, 0, -0.05 do`
SprtSpeed += -45
WalkSpeed += -10
Player.Character.Humanoid.WalkSpeed = 0
MakeHitbox(0, 7, 7, 7)
task.wait(0.01)
if lungehit == true then
PlayAnimEvent:FireAllClients(Player, "LungeHit")
Player.Character.HumanoidRootPart.Anchored = false
break
end
`end`
`LV.MaxAxesForce = Vector3.new(0, 0, 0)`
`LV.Enabled = false`
`task.wait(0.1)`
`if lungehit == true then`
script.Parent.HumanoidRootPart.Lunging:Stop()
script.Parent.HumanoidRootPart.LungeHit:Play()
lungehit = false
print("Lunge was landed")
playertodmg:FindFirstChild("Humanoid").Health -= 25
BleedEvent:Fire(Player, playertodmg, 10, 0.5)
task.wait(1)
SprtSpeed = 45
WalkSpeed = 10
Player.Character.Humanoid.WalkSpeed = 10
task.wait(1)
AbilityActive = false
`elseif lungehit == false then`
Player.Character.HumanoidRootPart.Anchored = false
script.Parent.HumanoidRootPart.Lunging:Stop()
print("Lunge was missed")
script.Parent.HumanoidRootPart["LungeMiss/Wall"]:Play()
PlayAnimEvent:FireAllClients(Player, "Stunned")
task.wait(1.5)
PlayAnimEvent:FireAllClients(Player, "StunRecover")
task.wait(0.25)
SprtSpeed += 45
WalkSpeed += 10
Player.Character.Humanoid.WalkSpeed = 10
task.wait(1)
AbilityActive = false
`elseif lungehit == "Wall" then`
Player.Character.HumanoidRootPart.CFrame = Player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, 3)
Player.Character.HumanoidRootPart.Anchored = false
script.Parent.HumanoidRootPart.Lunging:Stop()
print("Lunge hit a wall")
script.Parent.HumanoidRootPart["LungeMiss/Wall"]:Play()
PlayAnimEvent:FireAllClients(Player, "Stunned")
task.wait(2.5)
PlayAnimEvent:FireAllClients(Player, "StunRecover")
task.wait(0.25)
SprtSpeed += 45
WalkSpeed += 10
Player.Character.Humanoid.WalkSpeed = 10
task.wait(1)
lungehit = false
AbilityActive = false
`end`
`playertodmg = nil`
`hitboxhit = false`
what i want is the hitboxes to drag instead of being attached to the player without going behind the player, and i want the player to instantly stop upon contact with another player. However i cant seem to get it to work.