the pistol3 is next why ? (It's for a unlock the next item to buy)
This is a video with the bug https://www.youtube.com/watch?v=bCXXtnPLcVI
local Player = game.Players.LocalPlayer local ReplicatedStorage = game.ReplicatedStorage script.Parent.MouseButton1Click:Connect(function() if script.Parent.Parent.PetInventory.Visible == false then script.Parent.Parent.PetInventory.Visible = true local inventory = script.Parent.Parent.PetInventory.Inventory.InventoryFrame local plritem = Player:FindFirstChild("Items"):GetChildren() local itemfolder = ReplicatedStorage:FindFirstChild("Items"):GetChildren() for i = 1,#plritem do for j = 1,#itemfolder do if plritem[i].Name == itemfolder[j].Name then print(plritem[i].Name, itemfolder[j+1].Name) local item = inventory:FindFirstChild(itemfolder[j+1].Name) item.Background.Locked.Visible = false end end end else script.Parent.Parent.PetInventory.Visible = false end end)
19:29:19.471 - Players.xDZweird.PlayerGui.Shop.PetInventoryButton.LocalScript:16: attempt to index nil with 'Name' 19:29:19.472 - Stack Begin 19:29:19.472 - Script 'Players.xDZweird.PlayerGui.Shop.PetInventoryButton.LocalScript', Line 16 19:29:19.473 - Stack End Pistol Pistol2 Pistol2 Pistol3 Pistol4 Pistol5 Pistol5 Pistol6
I don't know if this is going to work, or if this is even the problem, but here I go. Let's say you have the following table:
local players = { player1 = "BrodyGamer101"; player2 = "xDZweird"; player3 = "Aiden16026" }
If you try to access each value as:
players[number]
It won't work. It will be nil. Instead, you have to change the table to be like:
local players = { "BrodyGamer101"; "xDZweird"; "Aiden16026" }
Then you can do
players[number]
Like I said, I have no idea if this is even relevant, but it's a good tip to all you out there.
When you buy one item a boolvalue is create with the name of the item, it is plritem in the script. It is a folder in plr