Im trying to check if 'Size' - a Frame on a surfaceGui - is bigger and smaller then a certain size
necessary parts of script:
local Gui = v.DataPanel.OutsideData.Border local Power = Gui.Factor3Answer local PowerBar = Power.Tween local Size = PowerBar.Size if WaterPart.WaterQuantity.Value == 1 then local Incremement = 0.005 if Size > UDim2.new(0,0,0,0) and Size < UDim2.new(1, 0, 0, 80) then PowerBar:TweenSize(UDim2.new(((Size + UDim2.new(Incremement, 0, 0, 0)))),"Out","Bounce",0.1, true) end end
it stops at line 7 saying:
attempt to compare two userdata values
The < operator is used for numbers, and UDim is not a number. The way to check it is probably to look at the absolute size, multiply the X and Y axes of it to get the area, and compare
To get the size needed on line 7 (scale), you need to get the screen size, which requires the mouse, so this needs to be put in a localscript.
local mouse = game.Players.LocalPlayer:GetMouse() local Gui = v.DataPanel.OutsideData.Border local Power = Gui.Factor3Answer local PowerBar = Power.Tween local Size = PowerBar.AbsoluteSize.X*PowerBar.AbsoluteSize.Y if WaterPart.WaterQuantity.Value == 1 then local Incremement = 0.005 if Size > 0 and Size < mouse.ViewSizeX * 80 then PowerBar:TweenSize(UDim2.new(((PowerBar.Size + UDim2.new(Incremement, 0, 0, 0)))),"Out","Bounce",0.1, true) end end