Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can someone Help with this welding script?

I got the actual welding part down, but how do i make it so the player can move with the part welded to them. This is all done when the player hits a key while the tool is equipped.

tool = script.Parent

player = game.Players.LocalPlayer
stat = "undone"
tool.Equipped:connect(function(mouse)
	mouse.KeyDown:connect(function(key)
		if stat == "undone" then
			stat = "done"

		print(key)
		local head = script.Parent.Parent.Head
		local part = Instance.new("Part")
		part.Parent = game.Workspace
		local w = Instance.new("Weld")
		part.CanCollide = false
		w.Part0 = head
		w.C0 = head.CFrame:inverse()
		w.Part1 = part
		w.C1 = part.CFrame:inverse()
		part.CFrame = head.CFrame * CFrame.new(0,15,0)
		w.Parent = head
		part.Anchored = true
		wait(15)
		stat = "undone"
		
		 
		
		
		
		end
	end)
	
end)

So far the actual part goes in the proper position but the player cannot move.

1 comment

0

Parts must be unanchored if you want to weld them and have them move with the character.

1 answer

✓ Accepted answer

In the end of the script (between "w.Parent = head" and "wait(15)") you have put "part.Anchored = true", but this would make the part unable to move. If you keep the anchored value False it would make the part movable, and it would still stick to the player. Therefore I would suggest you to change the "part.Anchored = true" to "part.Anchored = false".

I hope this helped

This discussion is preserved as it was. New answers, comments, and votes are closed.