Shop gui not working

“Attempted to index nil with name.” I’m not sure why this is happening. Appearantly this is where the output error message takes me to. I used alvinblox’s simulator shop model.

local description = game.ServerStorage.ToolModels[item.Name].Information.Description.Value

If you need any more info please tell me.

add the name of the item in between ToolModels. and .Information

Example:

local desc = game.ServerStorage.ToolModels.Gun.Information.Description.Value

yeah that’s mostly it, just make sure the tool has, Information and Description inside of it.

can u send the whole code and a picture the ServerStorage

– Generate blocks

local numberOfBlocks = #game:GetService(“ServerStorage”):WaitForChild(“ToolModels”):GetChildren()

local studGap = 9 – Gap between each box

local tools = game.ServerStorage.ToolModels:GetChildren()

local numberInOrders = {}

local debounce = false

local box = game.Workspace:WaitForChild(“ItemRoller”).Box0

table.sort(tools,
function(a, b)
return a.Information.Cost.Value < b.Information.Cost.Value
end
)

for i = 1,numberOfBlocks-1,1 do
newbox = box:Clone()
newbox:SetPrimaryPartCFrame(newbox.PrimaryPart.CFrame * CFrame.new(16*i,0,0))
newbox.Name = “Box”…i
newbox.Parent = game.Workspace.ItemRoller
end

for i, v in pairs(tools) do
if v then
new = v:Clone()
new:SetPrimaryPartCFrame(game.Workspace.ItemRoller[“Box”…i-1].Hitbox.CFrame)
new.Parent = game.Workspace.ItemRoller[“Box”…i-1]
end
end

game.ReplicatedStorage:WaitForChild(“RequestInformation”).OnServerInvoke = function(plr,item)

local data = {}
local bought = false
local description = game.ServerStorage.ToolModels[item.Name].Information.Description.Value
local title = item.Name
local cost = game.ServerStorage.ToolModels[item.Name].Information.Cost.Value
local costType = game.ServerStorage.ToolModels[item.Name].Information.CostType.Value

if game.ServerStorage.PlayerTools[plr.Name]:FindFirstChild(item.Name) then
– They have bought it
bought = true
else
bought = false
end

table.insert(data,1,title)
table.insert(data,2,description)
table.insert(data,3,cost)
table.insert(data,4,costType)
table.insert(data,5,bought)

return data

end

game.ReplicatedStorage.CreateTransaction.OnServerInvoke = function(player,item) – Item name, not object
local money = game.Players[player.Name].leaderstats.Cash
local cost = game.ServerStorage.ToolModels[item].Information.Cost

print(money.Value)
print(cost.Value)

if money.Value >= cost.Value and not game.ServerStorage.PlayerTools[player.Name]:FindFirstChild(item) then
– Success and the player has enough money
money.Value = money.Value - cost.Value
player.Character.Humanoid:UnequipTools()
for i, tool in pairs(player.Backpack:GetChildren()) do
if tool.Name == player.Equipped.Value then
tool:Destroy()
end
end

  player.Equipped.Value = item
  
  local tool = game.ServerStorage.Tools:FindFirstChild(item):Clone()
  tool.Parent = game.ServerStorage.PlayerTools[player.Name]
  
  local tool = game.ServerStorage.Tools:FindFirstChild(item):Clone()
  tool.Parent = player.Backpack
  
  return true

elseif cost.Value > money.Value and not game.ServerStorage.PlayerTools[player.Name]:FindFirstChild(item) then
– They don’t have enough money
return “not enough cash”
else
return “already bought”
end

end

game.ReplicatedStorage.GetToolsBought.OnServerInvoke = function(player)

local tools = {}

for i, tool in pairs(game.ServerStorage.PlayerTools[player.Name]:GetChildren()) do
table.insert(tools,tool.Name)
end

return tools

end

game.ReplicatedStorage.EquipTool.OnServerEvent:Connect(function(player,toolName)

player.Character.Humanoid:UnequipTools()

if player.Equipped.Value ~= nil then
if player.Backpack:FindFirstChild(player.Equipped.Value) then
player.Backpack[player.Equipped.Value]:Destroy()
end
end

player.Equipped.Value = toolName

local tool = game.ServerStorage.Tools:FindFirstChild(toolName):Clone()
tool.Parent = player.Backpack

end)

game.ReplicatedStorage.CloseShop.OnServerEvent:Connect(function(player)

game.Workspace[player.Name].HumanoidRootPart.CFrame = game.Workspace.TPPart.CFrame

game.Workspace[player.Name].Humanoid.WalkSpeed = 16

wait(2)

player.InShop.Value = false

end)

or i can just send you the whole model if you’d like that.

What are u sending in the item parameter when the server is invoked?

local replicatedStorage = game:GetService(“ReplicatedStorage”)
local gui = script.Parent.Parent.Parent
local frame = gui:WaitForChild(“ShopFrame”)
local buy = frame:WaitForChild(“Buy”)
local title = frame:WaitForChild(“Title”)
local description = frame:WaitForChild(“Description”)
local back = frame:WaitForChild(“Back”)
local DISABLED_BUTTON_COLOR = Color3.fromRGB(118, 110, 153)
local ENABLED_BUTTON_COLOR = Color3.fromRGB(255,255,255)
local itemRoller = game.Workspace.ItemRoller

local camera = game.Workspace.CurrentCamera

script.Parent.Activated:Connect(function()

local boxName = script.Parent.Parent.Parent.CurrentBox
local boxToMoveTo = boxName.Value + 1

if game.Workspace.ItemRoller:FindFirstChild(“Box”…boxToMoveTo) then
– There is a box for when we click the back button

  local tween = game:GetService("TweenService"):Create(
  	camera,
  	TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In,0,false,0),
  	{
  		CFrame = game.Workspace.ItemRoller["Box"..boxToMoveTo].CamPart.CFrame,
  		Focus = game.Workspace.ItemRoller["Box"..boxToMoveTo].Hitbox.CFrame
  	}
  )

  tween:Play()



  boxName.Value = boxName.Value + 1
  
  
  local model = nil

  for i, object in pairs(itemRoller["Box"..boxName.Value]:GetChildren()) do
  	
  	if object:IsA("Model") then
  		model = object
  		frame.ModelName.Value = object.Name
  	end
  	
  end
  
  local data = replicatedStorage.RequestInformation:InvokeServer(model)
  
  for i, v in pairs(data) do
  	print(v)
  end
  
  title.Text = tostring(data[1])
  description.Text = tostring(data[2])
  
  if data[5] == false then
  	buy.Text = "$"..tostring(data[3])
  end

else
print(“ah”)

  end

end)

im pretty sure that’s where the function is being invoked.

above the description variable do print(item.Name)

still says “Attempted to index nil with name”

no can u send a pic of the output window

wait where is the print function?

print(item.Name)
thats what the print function was

Is this it? image

oh that. yes there is a print function there

ok so u are running the script on the client side. Clients cant see server storage