please tell me if either my wait is to low or if i need to add another! thx
01 | local rightval = workspace.Part.value 1. Value |
02 | local leftval = workspace.Part.Value 2. Value |
03 | local father = script.Parent |
04 | local pos = father.Position |
05 | while true do |
06 | if pos = = Vector 3. new(rightval) then do |
07 | repeat pos = pos + Vector 3. new( 1 , 0 , 0 ) and wait( 1 ) until pos = = Vector 3. new(leftval) |
08 | wait ( 1 ) |
09 | end |
10 | if pos = = Vector 3. new(leftval) then do |
11 | repeat pos = pos - Vector 3. new( 1 , 0 , 0 ) and wait( 1 ) until pos = = Vector 3. new(rightval) |
12 | wait( 1 ) |
13 | end |
14 | end |
15 | end |
16 | end |
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:
01 | local rightval = workspace.Part.value 1. Value |
02 | local leftval = workspace.Part.Value 2. Value |
03 | local father = script.Parent |
04 | local pos = father.Position |
05 | while true do |
06 | if pos = = Vector 3. new(rightval) then do |
07 | repeat pos = pos + Vector 3. new( 1 , 0 , 0 ) and wait( 1 ) until pos = = Vector 3. new(leftval) |
08 | wait ( 1 ) |
09 | end |
10 | if pos = = Vector 3. new(leftval) then do |
11 | repeat pos = pos - Vector 3. new( 1 , 0 , 0 ) and wait( 1 ) until pos = = Vector 3. new(rightval) |
12 | wait( 1 ) |
13 | end |
14 | end |
15 | end |
16 | end |
to:
01 | local rightval = workspace.Part.value 1. Value |
02 | local leftval = workspace.Part.Value 2. Value |
03 | local father = script.Parent |
04 | local pos = father.Position |
05 | while true do |
06 | wait( 1 ) --the error was on this line because there was no wait-- |
07 | if pos = = Vector 3. new(rightval) then do |
08 | repeat pos = pos + Vector 3. new( 1 , 0 , 0 ) and wait( 1 ) until pos = = Vector 3. new(leftval) |
09 | wait ( 1 ) |
10 | end |
11 | if pos = = Vector 3. new(leftval) then do |
12 | repeat pos = pos - Vector 3. new( 1 , 0 , 0 ) and wait( 1 ) until pos = = Vector 3. new(rightval) |
13 | end |
14 | end |
15 | end |
16 | 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