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

How do i randomize the y - axis?

I have a imagelabel in a frame and im trying to tween the imagelabel to a random y axis but it does not work how its supposed to

local r = Random.new()
		
		
		clone.Parent = game.Players.LocalPlayer.PlayerGui.ScreenGui.spawnFrame
		
		clone.Position = UDim2.new(r:NextNumber(0,1), 0, 0.8, 0)
		
		clone:TweenPosition(UDim2.new(clone.Position.X, 0, r:NextNumber(0, 1), 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)

the x axis is random but the y axis is always the same

1 answer

I think the issue you have is that the UDim2 you make when tweening has too much data. For the scale of the position you are giving it both scale and offset. Instead you should give it clone.Position.X.Scale

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