You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
A accurate sword that uses GetPartsBoundsInBox -
What is the issue?
It isn’t accurate it sometimes damages then doesn’t on some hits or just breaks entirely
local debounce = false
local canattack = false
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local anim = Instance.new("Animation",tool)
anim.AnimationId = "rbxassetid://7652284269"
local player = script.Parent.Parent.Parent
local character = player.Character
wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local loadanim = animator:LoadAnimation(anim)
tool.Activated:Connect(function()
if not debounce then
loadanim:Play()
debounce = true
canattack = true
loadanim.Stopped:wait()
debounce = false
end
end)
while true do
wait()
local ovParams = OverlapParams.new()
ovParams.FilterDescendantsInstances = {script.Parent.Parent}
ovParams.CollisionGroup = "Default"
ovParams.FilterType = Enum.RaycastFilterType.Blacklist
ovParams.MaxParts = 100
local parts = workspace:GetPartBoundsInBox(handle.Hitbox.CFrame,handle.Hitbox.Size,ovParams)
if canattack == true then
for i,v in pairs(parts) do
if v.Parent:FindFirstChild("HumanoidRootPart") then
v.Parent.Humanoid:TakeDamage(10)
canattack = false
elseif not v.Parent:FindFirstChild("HumanoidRootPart") then
loadanim.Stopped:wait()
canattack = false
end
end
end
end