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

does anyone know how to weld a model to a player, and then make that part face forward?

does anyone know how to weld a model to a player, and then make that part face forward?

1 answer

function weldPartToCharacter(char)
	local root = char:WaitForChild("HumanoidRootPart")
	
	--new part to be created
	local part = Instance.new("Part")
	part.Anchored = false
	part.CanCollide = false
	part.Parent = char

	 --creates a weld with the humanoid root part and the newly created part
	local weld = Instance.new("Weld")
	weld.Part0 = root
	weld.Part1 = part

	--[[The CFrame difference of the part. 1 unit away on the x axis, 90 rotation on the y axis.
	The axes might be a bit different whenever welding when compared to the global ones]]-- 
	weldd.C1 = CFrame.new(1, 0, 0) * CFrame.Angles(0, math.rad(90), 0)
end

3 comments

0

do you know how to do this with a Motor6D

0

oh and when i say forward i mean forward for the player

0

Welds and Motor6Ds act very similar, this would likely still work if you replaced the word "Weld" on line 11 with "Motor6D"

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