Hey! My code isn’t working when i changing the 10, but i need to change number to variable
task.spawn(function()
for j = MovingTo.Value, #Multiway['1']:GetChildren() do -- here problem, when i use anything else but not number it not running code
print(j)
end
end)
for i = tonumber(MovingTo.Value), #Path.Points:GetChildren() do
if Humanoid.Health > 0 then
local Point = Path.Points:FindFirstChild(tostring(i))
local Multiway = Path.Points:FindFirstChild('Multiway'):: Folder
if Point then
Humanoid:MoveTo(Point.Position)
Humanoid.MoveToFinished:Wait()
MovingTo.Value = i
end
if i == #Path.Points:GetChildren() then
if Multiway then
local children = Multiway['1']:GetChildren()
local length = #children
task.spawn(function()
for j = MovingTo.Value, length do
print(j)
end
end)
else
Humanoid:MoveTo(Path.Exit.Position)
Humanoid.MoveToFinished:Wait()
if Enemy.Name == 'Arrow' then
Enemy:Destroy()
else
Enemy:Destroy()
end
end
end
end
end