How would I make a hitbox on the player's arm when they click, and make it do damage?

Title ^, I’m gonna make animations for punches, how would I make hitboxes and make it do damage on touch?

1 Like

I recommend using this library.

It’s very confusing, could I get an explanation?

Put a local script in starterpack, write a function that detects mouseclicks and run a remote event when clicked. Get the event, clone your hitbox and put a script into that hitbox for touched.

1 Like

LOCAL SCRIPT

local remote = game.ReplicatedStorage.ClickHitbox
script.Parent.GuiToggle.MouseButton1Click:Connect(function()
remote:FireServer("ClickHitbox")	
end)

SERVERSCRIPT:

local remote = game.ReplicatedStorage.ClickHitbox
remote.OnServerEvent(function(ClickHitbox)
-- Any ideas on what is next?

Sorry, I’m pretty new to scripting

local remote = game.ReplicatedStorage.ClickHitbox
remote.OnServerEvent(function(player, ClickHitbox)
    local HitBox = locationOfTheHitbox:Clone()
    HitBox.Parent =  player.Character
    HitBox.CFrame = ...
    HitBox.Touched:Connect(function(hit)
     -- u continue
    end)
end)
1 Like

Where would I find the hitbox, by the way?, Like, a transparent part?

You could either create a part instance and put it transparent or just clone one.

    local part = Instance.new("Part")
part.Name = Hitbox
part.Transparency = 1
part.Parent = --path

So, like this? (This is in the serverscript)

local part = Instance.new("Part")
part.Name = "Hitbox"
part.Transparency = 1
part.Size = ...
part.CFrame = ...
part.Parent = --path

Sorry for the late reply. Alright, I’ve finished the animation and I think I set the part’s parent to RightArm?

local remote = game.ReplicatedStorage.ClickHitbox
remote.OnServerEvent(function(player, ClickHitbox)
local part = Instance.new("Part")
part.Name = "Hitbox"
part.Transparency = 1
part.Size = ...
part.CFrame = ...
part.Parent = player.Character.RightArm

Not sure how I would set the size and CFrame though, to tune it with this kind of animation.
(https://gyazo.com/b1146fa57ac6de1270a2510f799b0ff5)
Any help?

Would I put it inside the arm, and make it stick out a little bit?

Forgot edit exists, sorry for the bump.

Either way, I’m still pretty new to scripting and need some help.