Is it possible to use a number after a section of a part's name to define or change the part?

I basically just want to know if something like this would be possible:

local points = game.partstorage:GetChildren() 
--[[
points includes the parts Point1, Point2, Point3, and Point4
]]
local number = 0
local int = 1


while true do
number += 1
int += 1

points[Point..number].Orientation.X += int

if number == #parts then
number = 0
end

wait()
end

I’m aware this code won’t run because of the issue of [Part..number], I’m asking if there’s another way to achieve what I’m trying to do with [Part..number].
I’m making a system that uses ‘_data’ instead of number, so pointing out I could use number’s value to determine which part I can rotate isn’t the solution I’m looking for. I would like to know if it’s possible to use strings instead of numbers. This could be used in the case of two seperate models, one called ‘x_data’, and the other being ‘x’. x could be used with this method to get the data stored in models.

local points = game.partstorage:GetChildren() 
--[[
points includes the parts Point1, Point2, Point3, and Point4
]]
local number = 0
local int = 1


while true do
	number += 1
	int += 1
	
	local object = points:FindFirstChild("Point" .. tostring(number))
	
	if points:FindFirstChild("Point" .. tostring(number)) then
		object.Orientation = Vector3.new(object.Orientation.X + int, object.Orientation.Y, object.Orientation.Z)
	end

	if number == #parts then
		number = 0
	end

	task.wait()
end
2 Likes

Apologies for taking a while to reply, I was testing it with my code. It works though, so thank you!

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