local image = script.Parent
while task.wait(0.1) do --change time if necessary
local randomOffset = math.random(-1, 1)/10 --change range if necessary (equal values around 0 make it move around the origin point)
image.Position = UDim2.new(image.Position.X.Scale, image.Position.X.Offset-randomOffset, image.Position.Y.Scale, image.Position.Y.Offset)
end
local oldpos = script.Parent.Position
while true do
script.Parent.Position = script.Parent.Position + UDim2.fromOffset(math.random(1,10),math.random(1,10))
wait()
script.Parent.Position = oldpos
end
This can easily be chalked up to math.random only returning integers and the minimum number being the first parameter/second being the maximum, in which more can be read here.
You could just do math.random(-15,-5)/100 and it’ll give you the result you’re looking for.
Additionally, I don’t recommend doing while true do
while wait(0.1) do
local x = math.random(-15,-5)/100
script.Parent.Position = UDim2.new(x,0,0.5,0)
end
local image = script.Parent
while task.wait(0.1) do --change time if necessary
local randomScale = math.random(-1, 1)/10 --change range if necessary (equal values around 0 make it move around the origin point)
image.Position = UDim2.new(image.Position.X.Scale + randomScale, image.Position.X.Offset, image.Position.Y.Scale, image.Position.Y.Offset)
end
Just realised you were trying to modify scale not offset.