How do i weld a part/weapon on character

Im trying to put a hammer to a charcacter but the hammer is in the middle of the right had and the animation is not working properly

Heres a video:


The part where the character looks up, the hammer should be in the air( Like hes throwing it). I animated the hammer to be in the air and do some spins.( roblox animation plugin)
At one point i fixed it but i changed something and it broke ( i have no idea what i changed or whats the cause)

I tried adding motor6d to the arm and make the PartC0 to the hammer, the hammer is in the hand but its in the middle and the hammer is not being animated. I tried using attachments but it didnt work( I added green circles to the chacacter hand and the hammer). I tried to put fake arm but its not being animated

Heres the script i use in game>ServerScriptService

local players = game:GetService("Players")
local sword = game:GetService("ServerStorage")["hammer"]

local function giveSword(character)
	local arm = character:WaitForChild("Right Arm", 1)
	if (arm ~= nil) then
		local s = sword:Clone()
		s.Parent = character
		local w = Instance.new("Motor6D")
		w.Part0 = arm
		w.Part1 = s
		w.Parent = arm
	end
end

local function connectPlayer(player)
	if (player.Character ~= nil) then -- if they already spawned
		giveSword(player.Character)
	end
	player.CharacterAdded:Connect(giveSword)
end

-- in the rare chance that players are in the game before the script runs
for _, player in ipairs(players:GetPlayers()) do
	connectPlayer(player)
end

players.PlayerAdded:Connect(connectPlayer)


Im not asking for a whole script. Any help will be appreciated

3 Likes

There is a plugin to position the tool without any scripting so if you have 5 Robux to spare then I recommend you using this plugin: Tool Grip Editor - Roblox

Or if you want to just to change the position for that tool, change 1 to any number that you want it position.

1 Like

the hammer is not a gear, It is a part. I clone the hammer and parent it to the character

Ok, since it is a part, I don’t think there is anything you can do it position it without making another script using Vector3. But I could be wrong so let me figure it out or someone will know the problem.

1 Like

I am so sorry for wasting your time. I gave up and changed the animation. It looks like the animation messed up and the hammer flying is not there. i fixed it now. Sorry for taking your time!
(BTW i animated a custom idle with the hammer in it so that i dont need to position the hammer)

Aw dang, but that fine, at least you figured it out :+1:

1 Like