Why is this occuring? Please help

Hi guys. I’m experiencing a huge issue! I’ve been at this for over a day now, and nothing has been fixed. My last topic was completely overlooked, and I’ve been trying to look on sites and more for how to fix this, but no results!
WHAT IT SHOULD DO

WHAT IT DOES

Also, for some reason the left glove completely destroys itself. If you can help me, I will greatly appreciate it! My progress has come to a halt because of this!

Code
GetParentChanged = Tool:GetPropertyChangedSignal("Parent")

GetParentChanged:Connect(function() -- Just a Tool:GetPropertyChangedSignal quoted earlier.
	if Tool:FindFirstAncestorOfClass("Model") then
		local Character = Tool.Parent
		local LeftArm = Character:FindFirstChild("Left Arm")
		local RightArm = Character:FindFirstChild("Right Arm")
		if not LeftArm or not RightArm or LeftArm:FindFirstChild("LeftGloveWeld") or RightArm:FindFirstChild("RightGloveWeld") then
			return
		end
		local Weld = script.LeftGloveWeld:Clone()
		Weld.Parent = LeftArm
		Weld.Part0 = LeftArm
		Weld.Part1 = LeftGlove
		LeftGlove.Anchored = false
		local Weld2 = script.RightGloveWeld:Clone()
		Weld.Parent = RightArm
		Weld.Part0 = RightArm
		Weld.Part1 = RightGlove
		RightGlove.Anchored = false
	end
end)
Weld CFrames

LEFTGLOVEWELD C0 POSITION: (0.16, -1.5, -0.07)
LEFTGLOVEWELD C0 ORIENTATION: (0, 0, -101.449)

RIGHTTGLOVEWELD C0 POSITION: (-0.13, -1.5, -0.07)
RIGHTTGLOVEWELD C0 POSITION: (0, 180, -101.449)

The C1 for both welds are (0, 0, 0).

2 Likes

Whenever I did welds(scripted) with positions, I had to include the CFrame inversed.

Example
local Weld = Instance.new("Weld")
Weld.Parent = LeftArm
Weld.Part0 = LeftArm
Weld.Part1 = LeftGlove
Weld.C0 = LeftArm.CFrame:Inverse()
Weld.C1 = LeftGlove.CFrame:Inverse()
weld.Parent = LeftArm

I now try to use Attachments for specific Positions.

Parts to Attachments then Welded
function weld(obj,anchor)
	local weldd = Instance.new("WeldConstraint")
	weldd.Parent = obj
	weldd.Part0 = obj
	weldd.Part1 = anchor.Parent
end

local btnn = LeftGlove -- needs an Attachment
local atcc = LeftArm.Attachment -- get's Attachment in Left Arm

btnn.CFrame = atcc.WorldCFrame * btnn.Attachment.CFrame:Inverse()
-- task.wait()
weld(btnn,atcc) -- Welds OBJ , Attachment

Customize the code so it works for both gloves

This is what I used, and it worked. I hope it works for you too. :smiley:
If not, let me know.

1 Like

Thank you for acknowledging this post. I’ll try this out! Just one thing I’d like to ask for you to make clearer. With the “needs an attachment” bit, does that mean I replace “LeftGlove” with the attachment? Or does it mean that the Left Glove needs an Attachment added?

2 Likes

You make a “Weld2” here, but then you forgot to change Weld to Weld2 on the next 3 lines, so your RightGlove is using a LeftGloveWeld to the RightArm, but the LeftGlove ends up not welded at all, so it falls out of the world.

Also, this did work, but now this is the outcome:


The CFrame isn’t changing to how it’s supposed to be.

New code:

function WeldObj(Obj, Anchor)
	local WeldConstraint = Instance.new("WeldConstraint", Obj)
	WeldConstraint.Part0 = Obj
	WeldConstraint.Part1 = Anchor.Parent
	Obj.Anchored = false
end

GetParentChanged:Connect(function()
	if Tool:FindFirstAncestorOfClass("Model") then
		local Character = Tool.Parent
		local LeftArm = Character:FindFirstChild("Left Arm")
		local RightArm = Character:FindFirstChild("Right Arm")
		if not LeftArm or not RightArm or LeftArm:FindFirstChild("LeftGloveWeld") or RightArm:FindFirstChild("RightGloveWeld") then
			return
		end
		local LeftAttachment = Instance.new("Attachment", LeftArm)
		LeftAttachment.Name = "LeftArmAttachment"
		local LeftGlove = LeftGlove -- needs an Attachment
		local LeftAttachment = LeftArm.LeftArmAttachment -- get's Attachment in Left Arm
		LeftGlove.CFrame = LeftAttachment.WorldCFrame * LeftGlove.Attachment.CFrame:Inverse()
		-- task.wait()
		WeldObj(LeftGlove, LeftAttachment) -- Welds OBJ , Attachment
		
		local RightAttachment = Instance.new("Attachment", RightArm)
		RightAttachment.Name = "RightArmAttachment"
		local RightGlove = RightGlove -- needs an Attachment
		local RightAttachment = RightArm.RightArmAttachment -- get's Attachment in Left Arm
		RightGlove.CFrame = RightAttachment.WorldCFrame * RightGlove.Attachment.CFrame:Inverse()
		-- task.wait()
		WeldObj(RightGlove, RightAttachment) -- Welds OBJ , Attachment
	end
end)

Thanks. I changed that up now. The CFrame is still wacky though.

Wacky how? What does your original code produce with the typo fixed? You don’t need any attachments or CFrame inverses here, because you have relative offsets already stored in your welds. But perhaps you have an unnecessary rotation or a sign issue on the x-offsets? Should be clear from looking at the results.

Look at the screenshot. Its CFrame is not working the way it should be. I’ve already posted my new form of code in my comment above replying to @Trainmaster2341. If this helps you any, both gloves have the same CFrame that their respective welds have. If you can’t remember it, just scroll back up to my topic and open the “Weld CFrames” section.

I was saying just make the typo fix to your original code and see what you get. Your original code is simpler, and I don’t see anything wrong with it besides just the typo.

The new version could probably be made to work also, but only if you set up the attachments on the gloves correctly, and there are no lines of code in the post above that either creates these attachments or sets their offsets (which should be the same as the original stored Welds’ C0 values), so it’s possible you’ve just not done that step. It looks like the gloves are welding right to the center of the arm part bounding boxes, suggesting their attachments are uninitialized.

Sorry for the late reply. Yes the gloves need attachments in them(put Attachments in gloves).
Also as @EmilyBendsSpace said, the Attachments will need to be adjusted to specific place(s) and orientation. That’s why both gloves in previous photo above show them facing the same direction(both attachments are facing the same direction).

A shortcut to show/hide Constraints is: Alt + D

Hey, I’m not sure if this is what you meant, but I changed the C0’s position in the studio. After getting the proper C0 position, it was the way I wanted it to be. So, if this is what you meant, then thank you. If not, please do explain what you meant. Sorry, I’m a bit stupid when it comes to CFrames. The first time I even saw “CFrame”, my eyes probably exploded before regenerating half a millisecond later.

Yes, that’s right. With the new code, you still need that offset that was being stored with the original Weld instances as C0, which was the offset from arm to glove, including rotation. It has to go somewhere, and the logical place is the Attachment.CFrame of the attachments that you’ve added to each glove.

The standard Roblox avatar and accessory setup uses this two attachment system, where you have an attachment on the body part that represents where an accessory is going to attach, and an attachment on the accessory that sets the point on the accessory that should line up with that point on the body part. With an old style Weld or Motor6D, the Attachment.CFrame values for the body and accessory attachment get copied to the Weld.C0 and Weld.C1 respectively.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.