Hi guys. I have gloves that the player can achieve once they reach a certain level. Once they achieve doing so, the gloves are put in their inventory and once equipped, they automatically weld to the player’s arms. However, the gloves are not being welded correctly and look very weird. Any way to fix this?
Code:
local Tool = script.Parent
local function AttachLeftGlove(Char)
if Char:FindFirstChild("Left Arm") then
local BodyPart = Char["Left Arm"] -- Change
local AttachPart = BodyPart
local Weld = Instance.new("Weld", AttachPart)
Weld.Name = "LeftGloveWeld"
Weld.Part0 = AttachPart
Weld.Part1 = LeftGlove
local Position = CFrame.new(AttachPart.Position)
local CFrame0 = AttachPart.CFrame:Inverse() * Position
local CFrame1 = LeftGlove.CFrame:Inverse() * Position
Weld.C0 = CFrame0
Weld.C1 = CFrame1
local Weld2 = Instance.new("Weld", BodyPart)
Weld2.Name = "LeftGloveWeld2"
Weld2.Part0 = BodyPart
Weld2.Part1 = AttachPart
Weld2.C0 = CFrame.new(0, 0, 0)
LeftGlove.Anchored = false
LeftGlove.CanCollide = false
end
end
local function AttachRightGlove(Char)
if Char:FindFirstChild("Right Arm") then
local BodyPart = Char["Right Arm"] -- Change
local AttachPart = BodyPart
local Weld = Instance.new("Weld", AttachPart)
Weld.Name = "RightGloveWeld"
Weld.Part0 = AttachPart
Weld.Part1 = RightGlove
local Position = CFrame.new(AttachPart.Position)
local CFrame0 = AttachPart.CFrame:Inverse() * Position
local CFrame1 = RightGlove.CFrame:Inverse() * Position
Weld.C0 = CFrame0
Weld.C1 = CFrame1
local Weld2 = Instance.new("Weld", BodyPart)
Weld2.Name = "RightGloveWeld2"
Weld2.Part0 = BodyPart
Weld2.Part1 = AttachPart
Weld2.C0 = CFrame.new(0, 0, 0)
RightGlove.Anchored = false
RightGlove.CanCollide = false
end
end
Tool.Equipped:Connect(function(Mouse)
local Character = Tool:FindFirstAncestorOfClass("Model")
if Character ~= nil then
AttachLeftGlove(Character)
AttachRightGlove(Character)
end
end)
Info: The gloves are UnionOperations. The left glove’s position is (-0.764, 2.524, 26.024). The left glove’s orientation is (0, 0, -101.449). The right glove’s position is (1.929, 2.527, 25.993). The right glove’s orientation is (-0, -180, -101.449).
Hope that info helps you out or at least the code tells you something. Thanks a ton if you can help me.