hey guys i am making a combat system for a model i am working on but, the hitbox just wont detect on the model… i dont know why it doesnt detect but i think it is bc off the model being located in the rig
this is the script i made;
local function isSusanoo1BasePart(hit)
if hit:IsA("BasePart") or hit:IsA("MeshPart") or hit:IsA("ParticleEmitter") and hit.Name == "Arm1" or hit.Name == "Arm2" or hit.Name == "Base" or hit.Name == "Hand" or hit.Name == "RealBase" then
return true
else
return false
end
end
local function attack(tim, dmg, Player)
if hitbox == nil or char == nil then -- Check if hitbox or char is nil before proceeding
return
else
hitbox.CFrame = char.HumanoidRootPart.CFrame + char.HumanoidRootPart.CFrame.LookVector * 3
hitbox.Orientation = char.HumanoidRootPart.Orientation
hitbox.Parent = game.Workspace
debris:AddItem(hitbox, 0.5)
hitbox.Touched:Connect(function(Hit)
if not Hit:IsDescendantOf(char) then
if Hit:IsA("Part") or Hit:IsA("MeshPart") then
print(Hit)
if isSusanoo1BasePart(Hit) and not debounce then
print("UES")
end
local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
local humrp = Hit.Parent:FindFirstChild("HumanoidRootPart") or Hit.Parent.Parent:FindFirstChild("HumanoidRootPart")
if (Humanoid ~= nil) and not debounce then -- Use "not" instead of "== false" for clarity
debounce = true
local Hitanim = Humanoid:LoadAnimation(game.ReplicatedStorage.HitAnims:FindFirstChild("Hit1"))
Hitanim:Play()
Humanoid.WalkSpeed = 5
sound.Parent = Hit
sound:Play()
debris:AddItem(sound, 1)
if Hit then
if hiteffect1 == not nil then
hiteffect1.Parent = Hit
end
if hiteffect2 == not nil then
hiteffect2.Parent = Hit
end
end
debris:AddItem(hiteffect1, 0.2)
debris:AddItem(hiteffect2, 0.2)
Humanoid:TakeDamage(dmg)
wait(tim)
Humanoid.WalkSpeed = 16
debounce = false
end
end
end
end)
while debris and wait(0.001) do
if char and char.HumanoidRootPart then -- Check if char and HumanoidRootPart exist
hitbox.CFrame = char.HumanoidRootPart.CFrame + char.HumanoidRootPart.CFrame.LookVector * 3
hitbox.Orientation = char.HumanoidRootPart.Orientation
else
break -- Exit the loop if char or HumanoidRootPart is nil
end
end
end
end
this is the location off what i want to detect:
does anybody know how i would fix this?
all help is appreciated ty!