It is not possible to select a random text position in the radius from and to

So I want my text to appear at a certain point on the screen, but I do not want it to, for example, went out of bounds, for this I try to select a random number from 0.2 to 0.8, but why my text always appears here, why?

here’s the script:

local cloneText = player.PlayerGui.PowerUp.plusPower:Clone()
				cloneText.Parent = player.PlayerGui.PowerUp
				cloneText.Visible = true
				cloneText.Name = "plusPowerClone"
				cloneText.countText.Text = player.Data.PlusDamage.Value
				cloneText.Position =, 0.8), 0, math.random(0.2, 0.8), 0)
1 Like

math.random returns an integer between the starting position and the end position. As it is an integer, it doesn’t work with decimal values, instead returning 0 in this case.

One way of getting around this is to get the number between integers with a larger magnitude, and then dividing it by that magnitude.

cloneText.Position =, 800)/1000, 0, math.random(200, 800)/1000, 0)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.