Here is the code i just write:
local step = workspace.Step:GetChildren()
local currentPos = 1
local function moveDummy()
local random = math.random(1,6)
currentPos = currentPos + random
humanoid:MoveTo(step[currentPos].PrimaryPart.Position)
end
At first, it work fine. But when almost at the end of tables values, it throw an error :
Workspace.TestButton.Button.MoveDummy:13: attempt to index field '?' (a nil value)

4 comments
Whatever error you have isn't in the code you posted. The error is because the script can't find a child. Your parents are wrong or the object doesn't exist yet.
Maybe i can change the math.random that calculate the residual value of the table(if residualValue < maxRandom then maxRandom = residualValue)
There’s no line 13...?
Sorry, this is not the full code.