Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

attempt to compare two userdata values when i do > UDim2.new(blah blah blah)?

for i,v in pairs(script.Parent.Holder["1"]:GetChildren()) do
			if v.Position < UDim2.new(0.056, 0,0.747, 0) then -- or > still didn't work
				v:Destroy()
			end
		end

error: attempt to compare two userdata values

idk what's the reason i just wanna fix that very quick

2 comments

0

Try using magnitude so like v.Position.magnitude or try do v.Position.X < and then make like a part with that position and link to the X value of that. It might work :D

0

That won't work he is using GUI objects not parts.

1 answer

I can't confirm this as a working solution since this is sort of guess work..

local function Compare(UDim1,UDim2)
local xs1 = UDim1.X.Scale
local ys1 = UDim1.Y.Scale
local xs2 = UDim2.X.Scale
local ys2 = UDim2.Y.Scale
if xs1 > xs2 and ys1 > ys2 then
return true
end
end
for i,v in pairs(script.Parent.Holder["1"]:GetChildren()) do
            if Compare(v.Position,UDim2.new(0.056, 0,0.747, 0)) then -- or > still didn't work
                v:Destroy()
            end
        end

This discussion is preserved as it was. New answers, comments, and votes are closed.