local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("PunchDamage")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local tool = script.Parent
local debounce = false
local punchAnimation = Instance.new("Animation")
punchAnimation.AnimationId = "rbxassetid://72174331131009" -- troca se quiser
local punchSound = Instance.new("Sound")
punchSound.SoundId = "rbxassetid://8595980577"
punchSound.Volume = 1
punchSound.Name = "PunchSound"
local character, humanoid, animator, animationTrack
tool.Equipped:Connect(function()
character = player.Character or player.CharacterAdded:Wait()
humanoid = character:WaitForChild("Humanoid")
if not character:FindFirstChild("PunchSound") then
punchSound:Clone().Parent = character
end
animator = humanoid:FindFirstChildOfClass("Animator") or
Instance.new("Animator", humanoid)
animationTrack = animator:LoadAnimation(punchAnimation)
mouse.Button1Down:Connect(function()
if debounce then return end
debounce = true
if animationTrack then
animationTrack:Play()
end
local sound = character:FindFirstChild("PunchSound")
if sound then sound:Play() end
local root = character:FindFirstChild("HumanoidRootPart")
if root then
local punchPart = Instance.new("Part")
punchPart.Size = Vector3.new(3, 4, 3)
punchPart.Transparency = 1
punchPart.CanCollide = false
punchPart.Anchored = true
punchPart.CFrame = root.CFrame * CFrame.new(0, 0, -2)
punchPart.Parent = workspace
local connection
connection = punchPart.Touched:Connect(function(hit)
local targetHumanoid = hit.Parent and
hit.Parent:FindFirstChild("Humanoid")
if targetHumanoid and hit.Parent ~= character then
RemoteEvent:FireServer(targetHumanoid, 15) -- 15 de
dano
end
end)
game:GetService("Debris"):AddItem(punchPart, 0.3)
task.delay(0.3, function()
connection:Disconnect()
end)
end
task.wait(0.5)
debounce = false
end)
end)