Help turn path with string into proper path

Im scripting infinite road generation and ran into a problem that i cannot generate it while player is near the last piece of it, because i cannot make proper path without getting error in my script.
local part = (game.Workspace.Roads.."Road_"..Index)
Index is number
final path must be like game.Workspace.Roads.Road_NUMBER

Use brackets []

local part = game.Workspace.Roads["Road_"..Index]
3 Likes

Although you can use brackets I recommend FindFirstChild to be the better options

local road=roadpath:FindFirstChild(`Road_{Index}`)
1 Like

Tysm, now i can continue development!

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