Precise positions with welds

Hi, I am currently making an infinity gauntlet(simulator) game. I have come across an issue where after I weld the gauntlet to the player when they spawn I can’t position the stones(all seperate object, but the gauntlet is one).
I tried measuring the distance the gauntlet travels when it’s position is changed on spawn and applying that same distance to each stone but they end up getting the same position far away from player.


local gauntlet = script.Parent
local character = gauntlet.Parent
local hand = character:WaitForChild("Left Arm")
local player = game.Players:GetPlayerFromCharacter(character)

for i, v in pairs(workspace:WaitForChild("Gauntlets"):GetChildren()) do
	
	if v.Owner.Value == player.Name then
		
		v:Destroy()
		
	end
	
end

local oldPosition = gauntlet.Position

gauntlet.CFrame = hand.CFrame * CFrame.new(0, 0.5, 0.1)

gauntlet.Owner.Value = player.Name

gauntlet.Parent = workspace:WaitForChild("Gauntlets")

for i, v in pairs(gauntlet.Stones:GetChildren()) do
	
	local weld = Instance.new("Weld", v)
	weld.Part0 = gauntlet
	weld.Part1 = v
	weld.C1 = gauntlet.CFrame
	weld.C0 = v.CFrame
	
end

local weld = Instance.new("Weld", gauntlet)
weld.Part0 = gauntlet
weld.Part1 = hand
weld.C0 = gauntlet.CFrame
weld.C1 = hand.CFrame

gauntlet.Orientation = Vector3.new(0, 0, 0)
gauntlet.Position -= Vector3.new(0, 0.5, -0.1)

local newPosition = gauntlet.Position

local difference = newPosition - oldPosition

print(difference)

for i, stone in pairs(gauntlet.Stones:GetChildren()) do

	print(stone.Position)

	stone.Position += difference

	print(stone.Position)

end

task.wait(1)



if player:WaitForChild("SaveValues"):WaitForChild("Gear"):WaitForChild("Gauntlet").Value then

	for i, v in pairs(player:WaitForChild("SaveValues").Gear:GetChildren()) do
		
		if v.Value then
				
			if gauntlet.Stones:FindFirstChild(v.Name) then
					
					
				gauntlet.Stones:FindFirstChild(v.Name).Transparency = 0

			end

		end

	end

else

	gauntlet.Transparency = 1

end



(I anchored it afterwards to take the picture, because it is welded it moves with my animation)

I need to keep all the stones as seperate objects in order to turn them invisible individually.

Thanks in advance!

First, use weld constraint, second, try using weld constraint and weld the stones with the gauntlet so their position updates when the gauntlet’s position updates.
way too much overengineering but good trying to solve your solution yourself other then giving up instantly!

That was what I did in the first place. It still did the same thing as this. What I did here was to try fix it, but it gave the same results :confused:

It turns out I was welding stones to gauntlet, but when I welded gauntlet to stones this happened:

Thanks for the help anyways, I am one step closer to solving it

Might not be the most practical solution, but what I did is move each stone a bit by bit until it fit perfectly

image

Thank you for the help!

Sorry I couldn’t reply instantly, was out for the entire day at the mall and gym. I should have clarified that the stones should be unanchored when you constraint them to the gauntlet and so should the gauntlet when welded to the character because the character is already anchored (via constraints and some other stuff to the root part or smth idk) and that would’ve been your fix. That’s what I do when making tools that require several parts. Make a handle, parent the other parts to the handle, make sure everything is unanchored (due to tool handle being locked in by some hidden constraint) and use a weld constraint to itself as part0 and then to handle (the main body) as part1, same could’ve been done in this instance.

Glad you were able to solve the solution by yourself though, true programmer.

Thanks, but I know that it needs to be unanchored(and it was). I think you confused it with when I said I anchored stones to take picture. Also, the gauntlet isn’t tool but just object welded to the character(since there won’t be tools in this game). Anyways, I made it at the endand from that point things went smoothly.