I’m trying to get only the first number of Position.X from a Draggable frame, to put this value on the player’s screen, I’ve tried to use Split, but I couldn’t
Looks like you are trying to grab the offset. Maybe try:
local Position = v.Parent.Position.X.Offset
Then round it while it’s a number
Then convert to string if needed
No, Im trying to grab the Scale size
Ah. Position.X.Scale would be what you need then.
My code looks like this now:
but just return 0 or 1, i want like 0.1, 0.3, 0.6, 0.9, 1
If you don’t round, is it giving the values like what you want (only not rounded)?
If you can get the decimal number you need, it can be rounded for display in the string with something like:
local value = 1.223345
local str = string.format("%.1f", value)
print(str)
You’re asking for a percentage that represents the distance to the far right end of the slider. With respect to UIDragDetector
s, that looks like so:
local progress = UiDragDetector.DragUDim2.X.Offset / (Bar.AbsoluteSize.X - Slider.AbsoluteSize.X)
Thank u friend, its work
Additionally, you can get a numeric rounded value with something like this
local value = 1.223345
local roundTo = 0.1
local rounded = math.round(value / roundTo) * roundTo
print(rounded)
roundTo = 0.1
rounds to the nearest tenths place, roundTo = 0.01
rounds to hundredths place, and so on.
Also works in the other direction: roundTo = 10
would round to the nearest tens place, roundTo = 100
rounds to nearest hundred, etc.