I have a module script in ReplicatedStorage and a script in a tool. In the module script I have a function w. 3 parameters, the values of which are set in the script. For some reason, I used one of the parameters in the module script, and it errored, saying "chicken is not a valid member of StarterPack" in the module script.
MODULE SCRIPT:
local module = {} local player = game.Players.LocalPlayer local leaderstats = player.leaderstats module.giveChickenEaten = function(chicken, chickenIntValue, biteAmount) print("Calculating chicken eaten...") leaderstats["Chicken Eaten"].Value = leaderstats["Chicken Eaten"].Value + game.StarterPack.chicken.chickenIntValue.Value --chikcen is not a valid member of StarterPack biteAmount.Value = biteAmount.Value - 1 if biteAmount.Value == 0 then chicken:Destroy() end end return module
SCRIPT:
local module1 = require(game.ReplicatedStorage.ModuleScript) --where the module script is activated module1.giveChickenEaten(script.Parent, script.Parent.coldFriedChickenValue.Value, script.Parent.biteAmount.Value) --(this is activated inside a function)
Thanks!
Put this after line 5:
game.StarterPack:WaitForChild("chicken")
Or, maybe there is nothing called "chicken" in the starterpack. Are you sure it's the starterpack and not the specific startergear of the player?