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

Weld is rotating my armor piece?

Hello, I have a script that duplicates a set of armor and welds it on the players' torso. It works, but the problem is that it's rotated. It's supposed to look like this, but instead it looks like this. Here is my script:

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
local Armor  = script.Parent:Clone()
Armor.Parent = character
Armor.CFrame = character["Torso"].CFrame
local Weld =  Instance.new("Weld" , character["Torso"])
    Weld.Part1 = Armor
    Weld.Part0 = character["Torso"]
    end)
end)

Just a quick question. Any help appreciated! Thanks!

1 answer

✓ Accepted answer

It appears that the objects aren't aligned correctly with no relative offset rotation. Try running the code snippet that positions the Armor from command line to see if the armor is appearing rotated or not. If it isn't, I have no clue what's up, but if it is then you simply have to modify the Weld's C1 to accomodate:

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        local Armor  = script.Parent:Clone()
        Armor.Parent = character
        Armor.CFrame = character["Torso"].CFrame
        local Weld =  Instance.new("Weld" , character["Torso"])
			Weld.C1 = CFrame.Angle(0, math.pi/2, 0) --90* rotation about the y axis. Might need to be negative.
            Weld.Part1 = Armor
            Weld.Part0 = character["Torso"]
    end)
end)

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