i was make a remote-function so the inventor script can show images but on line 17 is gives the error bad argument #2 to '?' (string expected, got Object) but as far is as i know its getting a string.
client side code:
local IOS = 0 local Xs = 0.0 local Ys = 0.377 local placeholeder = script.Parent.Parent.Defal.ImageLabel function items() for _, child in pairs(script.Parent:GetChildren()) do if child.Name ~= "Itmesscripts" then child:Destroy() end IOS = 0 Ys = 0.027 Xs = 0.039 end for _, child in pairs(game.Players.LocalPlayer.items:GetChildren()) do if child.Value > 0 then local ChildName = child.Name local NAME = game.ReplicatedStorage.GetItemNameAndImg:InvokeServer(ChildName) placeitem(NAME[1],child.Name,NAME[2]) end end end function placeitem(NAME,ID,img) local itme = placeholeder:Clone() itme.Parent = script.Parent.Parent.ScrollingFrame local XYs = UDim2.new(Xs,0, Ys, 0) itme.Position = XYs IOS = IOS + 1 if Xs == 0.0 then Xs = 0.562 else Xs = 0 Ys = Ys + 377 end itme.Name = NAME itme.Image = "rbxassetid://" + img local amout = game.Players.LocalPlayer.items[ID].Value itme.TextLabel.Text = NAME .. "\n" .. amout itme.Visible = true end while true do items() wait(1) end
Sever side code:
function GetItemNameAndImg(ID) return({game.ServerStorage.items[ID].name.Value,game.ServerStorage.items[ID].LogoID.Value}) end game.ReplicatedStorage.GetItemNameAndImg.OnServerInvoke = GetItemNameAndImg
I don't know for sure if this will solve your issue, but an issue with your code is here: function GetItemNameAndImg(ID)
. Whenever you make a OnServerEvent/OnServerInvoke function, the first parameter is always the player that called it. Meaning "ID" is the player and not the ChildName variable you had. To fix this: Add a second parameter slot called ID and change the first one to plr or something among those lines.