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

2 comments
Have you tried printing ChildName to see what it prints?
Try setting the NAME variable to nil while it isn't being used. or just set it as an empty sting value like local NAME = ""