Got a script in a coin for a simulator that’s supposed to check what custom backpack from a module script a player has when it’s touched
Coin’s Script:
local RS = game:GetService("ReplicatedStorage") local Backpacks = require(RS.BPacks.Packs) -- Get list of Backpacks script.Parent.Touched:Connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then local PlayerBPack = player.BPacks.Value -- Get player's custom backpack (StringValue) local CheckPack = table.find(Backpacks.Packs,PlayerBPack) -- Look for PlayerBPack in the Module script print(CheckPack) -- Print Player's current BPack + Info end end)
Module Script:
Module = {} Module.Packs = { Default = { Name = "Default", Size = 5, Cost = 0 }, } return Module
CheckPack keeps printing nil and I’m not sure why, can someone help me?