0% found this document useful (0 votes)
437 views2 pages

Punch Damage Script for Roblox

This script enables a punching mechanic in a Roblox game, where a player can perform a punch animation and sound effect when clicking the mouse. It creates a transparent punch part that detects collisions with other players' humanoids, dealing damage through a remote event. The script includes a debounce feature to prevent multiple punches from being executed in quick succession.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
437 views2 pages

Punch Damage Script for Roblox

This script enables a punching mechanic in a Roblox game, where a player can perform a punch animation and sound effect when clicking the mouse. It creates a transparent punch part that detects collisions with other players' humanoids, dealing damage through a remote event. The script includes a debounce feature to prevent multiple punches from being executed in quick succession.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local RemoteEvent = ReplicatedStorage:WaitForChild("PunchDamage")

local player = [Link]


local mouse = player:GetMouse()
local tool = [Link]

local debounce = false


local punchAnimation = [Link]("Animation")
[Link] = "rbxassetid://72174331131009" -- troca se quiser

local punchSound = [Link]("Sound")


[Link] = "rbxassetid://8595980577"
[Link] = 1
[Link] = "PunchSound"

local character, humanoid, animator, animationTrack

[Link]:Connect(function()
character = [Link] or [Link]:Wait()
humanoid = character:WaitForChild("Humanoid")

if not character:FindFirstChild("PunchSound") then


punchSound:Clone().Parent = character
end

animator = humanoid:FindFirstChildOfClass("Animator") or
[Link]("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 = [Link]("Part")
[Link] = [Link](3, 4, 3)
[Link] = 1
[Link] = false
[Link] = true
[Link] = [Link] * [Link](0, 0, -2)
[Link] = workspace

local connection
connection = [Link]:Connect(function(hit)
local targetHumanoid = [Link] and
[Link]:FindFirstChild("Humanoid")
if targetHumanoid and [Link] ~= character then
RemoteEvent:FireServer(targetHumanoid, 15) -- 15 de
dano
end
end)

game:GetService("Debris"):AddItem(punchPart, 0.3)
[Link](0.3, function()
connection:Disconnect()
end)
end

[Link](0.5)
debounce = false
end)
end)

You might also like