Is there a way to put a number After Local Part =?

Hi, I have been working on an obby and I wanted to make the checkpoints change in color when a player steps on it. but there was one problem, my checkpoints were named with numbers - like 1,2,3 etc. The problem is that whenever i put the numbers in it turns yellow, because its a number, and it doesnt work. there’s probably a way to do it with parent or something but i cant seem to figure it out.

Here’s the script - pretty simple:

local part =
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
part.BrickColor = BrickColor.new(“Lime green”)
end
end)

Thanks to everyone who helps!

If your part is named 1, and it’s under workspace, you can index it like this

local part = workspace["1"]

OH! thanks! i will see if it works!

I dont know if i did this right, the stages are in a folder named “Stages”
here is what i wrote - im a beginner at scripting so tell me if im wrong.

local part = workspace.Stages [“2”]

Yes you did it right, just make sure to remove the space that you included

local part = workspace.Stages["2"]
2 Likes