"attempt to compare two userdata values" ?????? Output: "18:33:15 -- attempt to compare two userdata values 18:33:19 -- Script 'Players.lucas4114.PlayerGui.ScreenGui.TradeMenu.TradingMenu.Market.Shop.LoadShopUnits', Line 18 18:33:19 -- Stack End" Script:
script.Parent.Changed:connect(function(vis) if vis == "Visible" then if script.Parent.Visible == true then local itemstodelete = script.Parent:GetChildren() for i,v in pairs (itemstodelete) do if v:IsA("ImageButton") then v:Destroy() end end local marketunitswithprice = {} local unitval = game.Workspace.SaveGlobalMarket.Items:GetChildren() for i,v in pairs (unitval) do marketunitswithprice[v.Price.Value] = v end table.sort(marketunitswithprice) for price, marketunit in pairs (marketunitswithprice) do local unit = game.ServerStorage.UNITS:FindFirstChild(marketunit.Name) local ItemGui = game.ServerStorage.MarketShopItemGui:Clone() ItemGui.Name = unit.Name ItemGui.Parent = script.Parent local ItemGuisinmarket = 0 for i,v in pairs (script.Parent:GetChildren()) do if v:IsA("ImageButton") then ItemGuisinmarket = ItemGuisinmarket + 1 end end local Ypos = ((ItemGuisinmarket - 1)*130) ItemGui.Position = UDim2.new(0,10,0,Ypos +6) ItemGui.Frame.ItemInGlobalMarket.Value = marketunit ItemGui.Frame.Player.Value = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name ItemGui.Frame.ImageLabel.Image = unit.Stats.RespawnGuiImageId.Value ItemGui.Frame.UnitDamage.Text = "Damage: "..unit.Stats.Damage.Value ItemGui.Frame.UnitDescription.Text = unit.Stats.Description.Value ItemGui.Frame.UnitHealth.Text = "Health: "..unit.Humanoid.MaxHealth ItemGui.Frame.UnitName.Text = unit.Name ItemGui.Frame.UnitPrice.Text = "Price: "..marketunit.Price.Value.." Gold." ItemGui.Frame.UnitRange.Text = "Range: "..unit.Stats.Range.Value ItemGui.Frame.UnitReloadTime.Text = "Reload Time: "..unit.Stats.ReloadTime.Value ItemGui.Frame.UnitRespawnTime.Text = "Respawn Time: "..unit.Stats.RespawnTime.Value ItemGui.Frame.UnitSpeed.Text = "Speed: "..unit.Humanoid.WalkSpeed ItemGui.Frame.UnitType.Text = unit.Stats.Type.Value ItemGui.Frame.BackgroundColor3 = unit.Stats.RespawnGuiBorderColor.Value ItemGui.Frame.UnitName.TextStrokeColor3 = unit.Stats.RespawnGuiTextOutlineColor.Value ItemGui.Frame.UnitName.TextColor3 = unit.Stats.RespawnGuiTextColor.Value if ItemGuisinmarket/2 == math.floor(ItemGuisinmarket/2) then script.Parent.CanvasSize = UDim2.new(0,0,(ItemGuisinmarket/2 + 1),0) end end end end end)
You are probably comparing two values such as if you were to compare a position and if you say something like this....
local torso = player.Character.Torso if torso.Position >= Vector3.new(5,5,5) then print("Wow...") end
Now the code above will have an error stating that you're comparing two userdata values but, you could use magnitude for the above example.. So if that is your problem try using magnitude or some other method. Thank you for reading this answer. Hope it helped you out.
As you can see on the error, the problem is in Line 18