Hello! What could be the reason for the hit box malfunction? The hit box constantly captures the player with different delays, either later or earlier, even though the code is the same?
(Or is it a problem with weld?) ![]()
The video clearly shows how it works
https://youtu.be/f83xpDOQvpc
I don’t quite understand the reason for this, but it might be because the hitbox appears due to the Marker in the animation?
Here is a small part of the script
Anim:GetMarkerReachedSignal("Hit"):Connect(function()
local function ReddLines(character)
local fine1 = Tool.VFX["fine...1"]:Clone()
fine1.Parent = workspace.Assets
fine1.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,-1,0)
task.spawn(function()
for i, particle in pairs(fine1:GetDescendants()) do
if particle:IsA("ParticleEmitter") and particle.Name ~= "constantowindo" and particle.Name ~= "smoksmokenable" then
spawn(function()
particle:Emit(particle:GetAttribute("EmitCount"))
end)
particle.Enabled = true
end
end
task.wait(0.3)
for i, particle in pairs(fine1:GetDescendants()) do
if particle:IsA("ParticleEmitter") then
particle.Enabled = false
end
end
end)
game.Debris:AddItem(fine1, 2)
end
local function Smoke(character)
local fine1 = Tool.VFX["fine...1"]:Clone()
fine1.Parent = workspace.Assets
fine1.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,-1,0)
task.spawn(function()
for i, particle in pairs(fine1:GetDescendants()) do
if particle:IsA("ParticleEmitter") and (particle.Name == "constantowindo" or particle.Name == "smoksmokenable") then
spawn(function()
particle:Emit(particle:GetAttribute("EmitCount"))
end)
particle.Enabled = true
end
end
task.wait(0.3)
for i, particle in pairs(fine1:GetDescendants()) do
if particle:IsA("ParticleEmitter") then
particle.Enabled = false
end
end
end)
game.Debris:AddItem(fine1, 1)
end
local HitBox = Instance.new("Part")
HitBox.Size = Vector3.new(5,5,5)
HitBox.Transparency = 0.9
HitBox.Color = Color3.new(1, 0, 0)
HitBox.CanCollide = false
HitBox.Anchored = true
HitBox.CFrame = root.CFrame * CFrame.new(0,0,-3)
HitBox.Parent = game.Workspace
game:GetService("Debris"):AddItem(HitBox, 0.1)
local hitlist = {}
local hit = 0
HitBox.Touched:Connect(function(v)
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character and v.Parent.HumanoidRootPart.Anchored == false then
if not hitlist[v.Parent.Humanoid] then
local function highlight()
local HighLight = game.ReplicatedStorage.Assets.Okarun.Highlight:Clone()
HighLight.Parent = v.Parent
HighLight.FillTransparency = 0
HighLight.OutlineTransparency = 0
local Tween = TweenService:Create(HighLight, TweenInfo.new(0.5), {FillTransparency = 1, OutlineTransparency = 1})
Tween:Play()
end
if hit == 1 then
return
end
hit = 1
hitlist[v.Parent.Humanoid] = true
local enemychar = v.Parent
local Eanim = enemychar.Humanoid:LoadAnimation(Tool.GetSlamed)
local eroot = v.Parent.HumanoidRootPart
Tool.LightHit:Play()
ReddLines(Character)
highlight()
Eanim:Play()
local Weld = Instance.new("WeldConstraint")
Weld.Parent = Character.HumanoidRootPart
Weld.Part0 = Character.HumanoidRootPart
eroot.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), 0)
Weld.Part1 = eroot
if enemychar.Humanoid.Health > 10 then
enemychar.Humanoid:TakeDamage(10)
else
enemychar.Humanoid:TakeDamage(enemychar.Humanoid.Health * 0.9)
end
Anim:GetMarkerReachedSignal("Throw"):Connect(function()
Tool["Throw"]:Play()
Smoke(Character)
Weld:Destroy()
Eanim:Stop()
Remote:FireClient(Player,{"shake",Character.HumanoidRootPart.Position,10,5})
if enemychar.Humanoid.Health > 5 then
Ragdoll.Enable(enemychar, 4)
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Velocity = Character.HumanoidRootPart.CFrame.LookVector * 30 + Character.HumanoidRootPart.CFrame.UpVector * 50
BodyVelocity.MaxForce = Vector3.new(10000, 10000, 10000)
BodyVelocity.Parent = eroot
game:GetService("Debris"):AddItem(BodyVelocity, 0.25)
enemychar.Humanoid:TakeDamage(5)
elseif enemychar.Humanoid.Health <= 5 then
Ragdoll.Enable(enemychar, 10)
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Velocity = Character.HumanoidRootPart.CFrame.LookVector * 50 + Character.HumanoidRootPart.CFrame.UpVector * 75
BodyVelocity.MaxForce = Vector3.new(10000, 10000, 10000)
BodyVelocity.Parent = eroot
game:GetService("Debris"):AddItem(BodyVelocity, 0.25)
enemychar.Humanoid:TakeDamage(5)
end
end)
end
end
end)
end)
Thanks