So I’m not sure how to fix this mess but this is what it does
Code:
local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")
local Model = Tool:WaitForChild("Model")
local Slash = script:WaitForChild("Slash")
local Debounce = false
local PlayersHit = {}
--Ads Welds--
for i, Parts in pairs(Model:GetChildren()) do
if Parts:IsA("BasePart") then
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = Parts
Weld.Part1 = Handle
Weld.Parent = Parts
end
end
--Animate--
Tool.Activated:Connect(function()
if Debounce == false then
Debounce = true
local Humanoid = Tool.Parent:WaitForChild("Humanoid")
local AnimTrack = Humanoid:LoadAnimation(Slash)
AnimTrack:Play()
wait(1)
Debounce = false
end
end)
--Damage--
Handle.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Tool.Parent then
if Debounce == true and PlayersHit[Hit.Parent] == nil then
Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(25)
PlayersHit[Hit.Parent] = true
wait(1)
PlayersHit[Hit.Parent] = nil
end
end
end)```