I'm trying to code that when you run out of water in the GUI I made, the hose that sprays water will be named to something else so it can't spray any longer.
while true do wait(1) if script.Parent.Size.Y >= (UDim.new(0, 0)) then game.Players.LocalPlayer.Character.Chest.hose.name = "broken" end end
Error: 17:07:40.871 - Players.Player1.PlayerGui.ScreenGui.water.Script:3: attempt to compare two userdata values
UDim2 does not have relational operators. If you want to check if the size is less than something, refer to the AbsoluteSize
, which is measured in pixels, or if you want to have it still in percent form, divide the AbsoluteSize
by workspace.CurrentCamera.ViewportSize
to get the relative size to the screen.