I figured it out! In the future click the error and on the line, the error was on add a wait before that line i had to change:
local rightval = workspace.Part.value1.Value
local leftval = workspace.Part.Value2.Value
local father = script.Parent
local pos = father.Position
while true do
if pos == Vector3.new(rightval) then do
repeat pos = pos + Vector3.new(1,0,0) and wait(1) until pos == Vector3.new(leftval)
wait (1)
end
if pos == Vector3.new(leftval) then do
repeat pos = pos - Vector3.new(1,0,0) and wait(1) until pos == Vector3.new(rightval)
wait(1)
end
end
end
end
to:
local rightval = workspace.Part.value1.Value
local leftval = workspace.Part.Value2.Value
local father = script.Parent
local pos = father.Position
while true do
wait(1)
if pos == Vector3.new(rightval) then do
repeat pos = pos + Vector3.new(1,0,0) and wait(1) until pos == Vector3.new(leftval)
wait (1)
end
if pos == Vector3.new(leftval) then do
repeat pos = pos - Vector3.new(1,0,0) and wait(1) until pos == Vector3.new(rightval)
end
end
end
end
so I moved the wait from the end to the beginning having the same effect with no errors the script doesn't work though