I need help with making a melee weapon without using a tool

I have already made a very VERY simple punching system but now if I want to add weapons like a baseball bat I need to do some more stuff? I’m really confused. I’m also very new to developing games and scripting so I’m sorry if I’m very bad. Thanks for reading
also here is the code

local character = script.Parent

local rightArm = script.Parent:WaitForChild("Right Arm")

local leftArm = script.Parent:WaitForChild("Left Arm")

local rightLeg = script.Parent:WaitForChild("Right Leg")

local leftLeg = script.Parent:WaitForChild("Left Leg")

local player = game.Players.LocalPlayer

local camerra = workspace.CurrentCamera

local humanoid = character.Humanoid

local alreadyAttack = false

local damaging = false

local camPart = workspace.Intro:FindFirstChild("Camera")
local animationR = game.ReplicatedStorage.Animations.PunchR
local animationL = game.ReplicatedStorage.Animations.PunchL
local uis = game:GetService("UserInputService")
local mouse = player:GetMouse()
----function
mouse.Button1Down:Connect(function()
	if not alreadyAttack then
		alreadyAttack = true
	
	local animL = humanoid:LoadAnimation(animationL)
	animL:Play()
	wait(0.5)
	alreadyAttack = false
	end
end)
  mouse.Button2Down:Connect(function()
	if not alreadyAttack then
		alreadyAttack = true
	local animR = humanoid:LoadAnimation(animationR)
	animR:Play()
	wait(0.5)
	alreadyAttack = false
	end
end)

rightArm.Touched:Connect(function(hit)
	if alreadyAttack == false and damaging == false then
		print("Not attacking")
		print(hit)
	elseif hit.Parent:FindFirstChild("Humanoid") ~= nil then
		if damaging == true then
			print("damaging")
	else
		damaging = true
		hit.Parent.Humanoid:TakeDamage(5)
		wait(0.5)
		damaging = false 
		end
	elseif hit.Parent.Name == player.Name then
		print("This is the player")
		   
	end
end)
leftArm.Touched:Connect(function(hit)
	if alreadyAttack == false and damaging == false then
		print("Not attacking")
		print(hit)
	elseif hit.Parent:FindFirstChild("Humanoid") ~= nil then
		if damaging == true then
			print("damaging")
	else
		damaging = true
		hit.Parent.Humanoid:TakeDamage(5)
		wait(0.5)
		damaging = false 
		end
	elseif hit.Parent.Name == player.Name then
		print("This is the player")
	end
end)

Here is some more information.
I’m using R6
This script is local
and i’m very bad at scripting

1 Like

Can we get some information like if you’re using R6 or R15? Next time you should follow the format and look it up before posting. This also belongs in #help-and-feedback:scripting-support

Here are some good tutorials:

R15:

R6:

Use the format below. To see the template/format and rules click on the topic and then the information tab it should be pinned…

2 Likes

Ok thanks but i joined the dev forum yesterday so I’m kind of new

2 Likes

I answered a question like this some days ago. Please do make use of the search function. New or not, that should always be a go-to when you’re looking to find something first before creating a thread on it.

Here are two posts I wrote in relation to creating a tool without tools (bonus of being able to use this system with a left hand to make dual wielding):

1 Like