How do I fix this?!?

Hello people, my goal is to weld a weapon to the hand of the player’s character without the tools but still look like this.

I placed the tool in the server storage and this is what I’ve tried with a server script:

local Players = game.Players
local ServerStorage = game:GetService("ServerStorage")
local Mjolnir = ServerStorage.Mjolnir
local Clone = Mjolnir:Clone()

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local RightHand = Character.RightHand
		Clone.Parent = Character
		Clone.CFrame = RightHand.CFrame
		local Weld = Instance.new("Weld")
		Weld.Part0 = RightHand
		Weld.C0 = RightHand.CFrame:Inverse()
		Weld.Part1 = Clone
		Weld.C1 = Clone.CFrame:Inverse()
		Weld.Parent = Clone
		
		
	end)
end)

But nothing works and no errors are seen in the output. I’ve tried setting the cframe of the hammer to that of the character’s right hand but the damn hammer doesn’t even appear in the workspace. I’ve watched and read several welding tutorials and articles but I can’t seem to piece together a solution as I’m not very experienced in welding.
Any solutions to fixing this?

OR should I be using motor6d?

1 Like

Have you tried weld constraints?

I’ve never worked with weld constraints in scripts before, do they function the same way?

image

I know how to add weld constraints manually, but i’m trying to weld with the script when the player joins.

Hi, before handling the CFrames of the parts of a character you must wait a while (i.e. “wait()”), I don’t know the explanation but, if you don’t do it it won’t work. You don’t need to set C0 and C1 because you want the hammer to be exactly in the hand position (i.e. no displacement).

local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local Mjolnir = ServerStorage.Mjolnir

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		wait()
		local RightHand = Character:WaitForChild("RightHand")
		local Clone = Mjolnir:Clone()
		-- Clone.CFrame = RightHand.CFrame  -- this code doesn't do anything

		local Weld = Instance.new("Weld")
		Weld.Part0 = RightHand
		Weld.Part1 = Clone
		--Weld.C0 = RightHand.CFrame:Inverse()
		--Weld.C1 = Clone.CFrame:Inverse()
		Weld.Parent = Clone
		
		Clone.Parent = Character
	end)
end)

Have a nice day.

Hi, so I made the corrections accordingly but nothing changed, the hammer still doesn’t even appear in the workspace.