I’m storing shop data in a ModuleScript, and here are some locals:
local Lighting = game:GetService("Lighting")
local ShopItems = Lighting.Pets
local player = game.Players.LocalPlayer
local ShopData = game:GetService("ServerScriptService"):FindFirstChild("ShopData")
local PetsData = ShopData["Pets"]
Well, there’s an error spawning in the line 5 (i think it’s 4)
[14:10:51.585 - Players.ConejinAlt.PlayerGui.Menu.PetsFrame.CheckSaleItems:5: attempt to index local 'ShopData' (a nil value)]
14:10:51.587 - Stack Begin
[14:10:51.588 - Script 'Players.Conejin_Alt.PlayerGui.Menu.PetsFrame.CheckSaleItems', Line 5]
14:10:51.590 - Stack End
ShopData is the Module which stores the shop data (prices, names, etc.)
The contents of ServerScriptService don’t replicate to the client. You’ll want to store it in ReplicatedStorage if you want it to be accessible from the client as well.
Also, this should probably be wrapped in a require() if you actually want to get the contents of the module.
Client haven’t the permission to access to the ServerScriptService.
There is what you should do :
Move your moduleScript into the ReplicatedStorage(Since this one can be used from the client)
In your localscript, just modify it like that :
local Lighting = game:GetService("Lighting")
local ShopItems = Lighting.Pets
local player = game.Players.LocalPlayer
local ShopData = require(game:GetService("ReplicatedStorage"):FindFirstChild("ShopData")) -- I added require() since you can't acces to a module without that.
local PetsData = ShopData["Pets"]