I have here my weld script but It doesn't weld the part to the specific place I want it to. What could I add to my code to make this work?
game.Players.PlayerAdded:Connect(function(Player) -- Player Player.CharacterAdded:Connect(function(Char() -- Character local Head = Char.Head -- Character's Body Part local Part = game.Workspace.Part -- Directory To Part To Weld local Weld = Instance.new('Weld', Head) -- Create Weld Weld.Part1 = Part Weld.Part0 = Head end) end) -- End
You could change the position of the part before the weld relative to the head. For example if you want to have the part one stud above the head
Part.Position = Head.Position +Vector3.new(0,1,0)
A weld has a C0
and C1
property. Which you can read about here: https://developer.roblox.com/en-us/api-reference/class/Weld
If you know the offset you could simply do this:
weld.C0 = offset
If you want to find the offset, use the command bar and do:
print(part0.CFrame:ToObjectSpace(part1.CFrame))