Hello, I was writing my combat script for my game by using region3 but i got a problem that it detect only once thing in region 3 can anyone help me?
Here my script
local function Hitbox()
local region,part do
part = Instance.new("Part")
part.Parent = character
part.Size = Vector3.new(10,10,10)
part.Transparency = 0.5
part.Anchored = true
part.CanCollide = false
part.CFrame = character.HumanoidRootPart.CFrame
local position, half_size = part.Position, part.Size *.5
region = Region3.new((position - half_size), (position + half_size))
end
local getTouchingParts = game.Workspace:FindPartsInRegion3(region, part)
for i,v in pairs(getTouchingParts) do
if canDamage == true then
if v.Parent ~= character then
if v.Parent:FindFirstChild("Humanoid") then
local hum = v.Parent:FindFirstChild("Humanoid")
print(v.Parent.Name)
if combo == 5 then
local bv1 = Instance.new("BodyVelocity", hum.Parent.HumanoidRootPart)
bv1.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv1.Velocity = character.HumanoidRootPart.CFrame.LookVector * 100
Debris:AddItem(bv1, .2)
end
hum:TakeDamage(10)
wait()
canDamage = false
end
end
end
end
Debris:AddItem(part, .1)
end
( i think it because the my region 3 create only once times, but i dont know how to create region3 multiple times )