Positioning Not Working

I’m not sure how to explain this, but I have a script that changes a few parts position and I want to position them where other transparent parts are and they’re called Item1, Item2, Item3, Item4, Item5 and Item6. So every time the for i, v in pairs() do loop fires, the i value will go up by one and then I can use that to do something like "Item"..i but this doesn’t seem to be working, here is my script:

local items = game.Workspace.Items:GetChildren()

game.Workspace.PlaceItems.ProximityPrompt.Triggered:Connect(function()
	if #items > 0 then
		game.Workspace.PlaceItems.ProximityPrompt.Enabled = false
		for i, v in pairs(items) do
			print(v.Name)
			print(v.Position)
			print(i)
			v.Position = game.Workspace.ItemPositions."Item"..i.Position -- I need help on this line.
			print(v.Position)
			wait(1)
		end
		game.Workspace.PlaceItems.ProximityPrompt.Enabled = true
		print("Finish")
	end
end)

Square brackets in this case are your best friend! I presume you want something like this

v.Position = game.Workspace.ItemPositions["Item"..i].Position

Well, that was easy. :rofl: Thank you EmbatTheHybrid.

1 Like