#Im stuck tryna figure out how to make the hitbox do damage to other humanoids and not the players

1 messages · Page 1 of 1 (latest)

grizzled fulcrum
#

local uis = game:GetService("UserInputService")
local char = script.Parent
local humanoidRootPart = char:FindFirstChild("HumanoidRootPart")
local db = false
local humanoid = script.Parent:WaitForChild("Humanoid")
local animationPriority = Enum.AnimationPriority.Action
local animationId = "92306948998386"

uis.InputBegan:Connect(function(input,typing)

if input.KeyCode == Enum.KeyCode.Q and not typing and db == false then
        local animation = Instance.new("Animation")
        animation.AnimationId = "rbxassetid://" .. animationId

        local animationTrack = humanoid:LoadAnimation(animation)
        animationTrack.Priority = animationPriority  -- Set the animation priority here
        animationTrack:Play()
        local hitbox = Instance.new('Part')
    hitbox.Size = Vector3.new(6, 6, 5)
    hitbox.Transparency = 0.9
    hitbox.CanCollide = false
    hitbox.Massless = true
    hitbox.Anchored = true
    hitbox.Color = Color3.new(1)
    hitbox.CFrame = humanoidRootPart.CFrame * CFrame.new(0, 0, (hitbox.Size.Z/2) * 0 )
    hitbox.Parent = workspace
    
    local partsInsideHitbox = workspace: GetPartsInPart(hitbox)
    local function hitboxFunction(v)
    end
    for i, v in pairs (partsInsideHitbox) do
        hitboxFunction(v)
    end
    wait(0.3)
    hitbox:Destroy()
    
    print("yay it works :D ")
    
    db = true
    task.wait(0.6)
    db = false
end

end)

#

sorry if this is the wrong catagory

#

im not really a big scripter guy lol

#

im just a artist

thorny harbor
#

Like before it does damage the script checks if the humanoids parent is a player

#

‘’’if not game.Players:FindFirstChild(humanoid.Parent) then’’’

#

Smt like that

grizzled fulcrum
thorny harbor
#

Well before it damages make sure the player it’s damaging isn’t the player

#

U can do this by just making sure the humanoid that the script is damaging isn’t its parents humanoid.

#

So like

#

if not script.Parent.humanoid == humanoid then

#

Or however ur referencing the humanoid

#

Can u show me the part of ur script that does the damaging

grizzled fulcrum
grizzled fulcrum
#

dont have it in the code anymore

#

uh

thorny harbor