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
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.