Vector3 random not working

I was trying to randomly move an object, however it won’t move. If you know why please tell me.

local a = script.Parent.Position
		local b = math.random(0, 1)
		local c = math.random(0, 1)
		local e = math.random(0, 1)
		local f = math.random(10, 20)
		local g = 0
		while wait(0.2) do
			if g == f then
				a = Vector3.new(a.X + b, a.Y + c, a.Z + e)
			else
				break
			end

if you think you have an awnser please tell me

It’s because g (0) will never equate to a number between 10 - 20.

How will g ever be equals to f? You have the random set between 10 - 20 meaning it will never be 0.

If you where to remove g == f it will very likely work.

thanks everyone i added the g = g + 1 at the end of the first loop however it still wont move

That’s because there’s a high chance g will still not equal to the random number since if g passes 20 then the loop will never move the part to a random Vector3.

i have no idea how i did not notice that mistake thank you