Cannot get a character from a tool

I wanted to make some basic sword or stuff like that,but for some reason it doesnt get the humanoid/Right Arm or stuff like that,heres the script:

local Tool = script.Parent
local Animation = Tool:WaitForChild("Swing")
print("Got the anim")
local Handle = Tool.yes
local debounce = false
Tool.Equipped:Connect(function()
	local char = Tool.Parent
	local Humanoid = char:WaitForChild("Humanoid") -- Doesnt get the humanoid?
	print("Got the humanoid")
	local RightArm = char:WaitForChild("Right Arm") -- The game is set to R6
	local Weld = Instance.new("WeldConstraint")
	print("Made the weld")
	Weld.Part0 = RightArm
	Weld.Part1 = Handle
	Weld.Parent = Handle
	Weld.Name = "HandWeld"
	Tool.Activated:Connect(function()

		local Swing = Humanoid:LoadAnimation(Animation)
		Swing:Play()
		print("Played the anim") -- Does print that
		Handle.Touched:Connect(function(hit)
			if hit.Parent.Name ~= Humanoid.Parent.Name then
				if hit.Parent:WaitForChild("Humanoid") then
					if debounce ~= true and Swing.Playing == true then
						debounce = true
						hit.Parent:WaitForChild("Humanoid"):TakeDamage(10)
						task.wait(3)
						debounce = false
					else
						
					end	
				end
			end
		end)
	end)

	Tool.Unequipped:Connect(function()
		Weld:Destroy()
	end)
end)



How can i make it get the humanoid & other stuff from a character?
Thanks in advance.

2 Likes

Nevermind your set to r6 already xd

Can you show me where the script is located?

the tool can’t be equiped without handle (if it should have it), so name the main part in the tool “Handle”

1 Like

It gets the humanoid now,but for some reason the animation doesnt play,do i need to create another like topic/post (idk how its called) and ask how do i make the animation play or i can ask a question here?

first of all, why do you need a weld constraint in a tool if its just a handle (also you better make the tool.Activated function outside the tool.Equiped function)?

Dont know,just decided to put it there

you better remove it, if you want it to be welded perfectly then edit the tool’s grip properties (you can make a test character to see how it’s welded)

a