Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

where would i put exacution wait time?

please tell me if either my wait is to low or if i need to add another! thx

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

1 answer

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)--the error was on this line because there was no wait--
	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

This discussion is preserved as it was. New answers, comments, and votes are closed.