Tool not welding to custom character

So currently i have this robot as my custom character named StarterCharacter. Whenever i try to weld the tool to the custom character, the tool just falls down and doesnt weld, plus all the animations also dont work, but give no error .Any way to fix this?
robloxapp-20220303-1224472
script for tool:

script.Parent:FindFirstChild("Handle"):Destroy()


script.Parent.Equip.OnServerEvent:Connect(function()
	local char = script.Parent.Parent
	if char:IsA("Model") then
		if not char:FindFirstChild("Handle") then
			local rHand = char:FindFirstChild("RightPalm")
			h.CFrame = rHand.CFrame * CFrame.new(0,0,-1.75)*CFrame.Angles(-math.rad(180),0,math.rad(180))
			local weld = Instance.new("Weld")
			weld.Part0 = rHand
			weld.Part1 = h
			weld.C0 = rHand.CFrame:inverse() * rHand.CFrame  
			weld.C1 = h.CFrame:inverse() * rHand.CFrame  
			weld.Name = 'HandleWeld'
			weld.Parent = rHand
			h.Parent = char
		end
	end
end)

local Tool = script.Parent
local Animation = Tool.Animation

Tool.Activated:Connect(function()
	local Character = Tool.Parent
	local Humanoid = Character.Humanoid

	local AnimationTrack = Humanoid:LoadAnimation(Animation)
	AnimationTrack:Play()
end)

try parent H first and then apply the weld? not sure just throwing out ideas

tried that, still no difference.

wait by tool falls down, do you mean it like falls off and is not connected to the character anymore, as in when you walk around, it doesnt move along with it?

it just falls off, it doesnt event weld to the character , neither does it move along with it

when the tool is equipped, check the location of the weld and see if it still contains part1 or part0

Have you tried printing to see if your event is firing? If so then here’s an example of how I’d script a weld function:

local Part = Instance.new("Part")

game.Players.PlayerAdded:Connect(function(Player)
	
	local function weldToPart(Part1, Part2)

		local Weld = Instance.new("WeldConstraint")
		Weld.Part0 = Part1
		Weld.Part1 = Part2

		Part1.CFrame = Part2.CFrame -- Just some basic CFraming
		Weld.Parent = Part1

		Part1.Parent = Part2.Parent

	end
	
	if Player.Character then
		weldToPart(Part, Player.Character:WaitForChild("HumanoidRootPart"))
	end
	Player.CharacterAdded:Connect(function(Character)
		weldToPart(Part, Character:WaitForChild("HumanoidRootPart"))
	end)
	
end)