#hitbox not destroying

1 messages · Page 1 of 1 (latest)

thorn cedar
bitter shuttleBOT
#

studio** You are now Level 5! **studio

tulip bay
#

UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.C then
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")

    local Anim = Humanoid:LoadAnimation(Animation)
    Anim:Play()

    local hitbox = Instance.new("Part")
    hitbox.Name = "sukunacleaveHitbox"
    hitbox.Size = Vector3.new(5, 5, 4)
    hitbox.Transparency = 0.6
    hitbox.CanCollide = false
    hitbox.Massless = true
    hitbox.Anchored = false
    hitbox.Color = Color3.new(255, 0, 0)
    hitbox.CFrame = HumanoidRootPart.CFrame * CFrame.new(0, 0, -3)
    hitbox.Parent = workspace

    local hitboxWeld = Instance.new("WeldConstraint")
    hitboxWeld.Part0 = HumanoidRootPart
    hitboxWeld.Part1 = hitbox
    hitboxWeld.Parent = hitbox

    task.wait(0.1)

    local partsInsideHitbox = workspace:GetPartsInPart(hitbox)

    local function hitboxFunction(v)
        print('Touched: ' .. v.Parent.Name)
    end

    for i, v in pairs(partsInsideHitbox) do
        hitboxFunction(v)
    end

    hitbox:Destroy()
end

end)

#

hope this helps 🙂

knotty tusk
#

use .fromRGB for 0-255 not .new

#

and that also goes to the OP as well

tulip bay
#

ok brio

bitter shuttleBOT
#

studio** You are now Level 1! **studio

thorn cedar
#

THANK YOU IT WORKS

thorn cedar