This is the module Script
function Shop.Sell(player) local Ore = Shop.OreName if player.OreMaterial[Ore].Value >= OreMod[Ore].price then player.leaderstats.Money.Value = player.leaderstats.Money.Value * OreMod[Ore].price player.OreMaterial[Ore].Value = 0 else print("Nothing to sell") end end
I get an error: 15:47:35.845 - ServerScriptService.ShopModule:9: attempt to index field 'OreMaterial' (a nil value) if player.OreMaterial[Ore].Value >= OreMod[Ore].price then is the part I need fixed
This is inside the LocalScript
local player = game:GetService("Players") function SellStone() game.ReplicatedStorage.LevelUp:FireServer( "Stone") end script.Parent.SellStone.MouseButton1Click:Connect(SellStone)
and this is the script where I access my RemoteEvents
function SellOre(player, Ore) ShopMod.OreName = Ore ShopMod:Sell(player) end