I know there’s simple a way to fix this but I genuinely can’t figure this one.
The problem is that x2 can sometimes return as a decimal. If I simply round it then everything will be off because x will still be the same. I need to find a way to make x always return x2 as a whole number with no remainder.
local x = delta.X
local x2 = delta.X/2
mainFrame.Size+=UDim2.fromOffset(x, 0)
mainFrame.Position+=UDim2.fromOffset(x2, 0)
So basically I can not change x2, but I am able to change x as much as I’d like. I need to always change x into a number that will return x/2 as a whole number without affecting x/2.
Does converting X into a number divisible by 2 work for your case? Not sure if this is what you are asking for…
local x = delta.X
if x % 2 ~= 0 then
x -= 1
end
local x2 = delta.X/2
mainFrame.Size+=UDim2.fromOffset(x, 0)
mainFrame.Position+=UDim2.fromOffset(x2, 0)
oh yeah I forgot I could check if that’s even, here’s the new code (I think I tried this before but was still using delta.x and not x so I thought it wasn’t working)
local x = delta.X
if x%2~=0 then
x+=1
end
local x2 = x/2
mainFrame.Size+=UDim2.fromOffset(x, 0)
mainFrame.Position+=UDim2.fromOffset(x2, 0)