Hello, I am working on a game and I came across some type of bug.
It's when a player joins, it creates his data in a module, but in a script it creates string, number values n stuff. I use a function for that but for some reason. It's just not running. I even put a print in the top, but not running at all. Here's the code. Inventory is a module.
CreateValues = function(Plr)
if Plr then
if Inventory.DataExists(Plr) then
local B = Instance.new("NumberValue", Plr)
B.Name = "Candy"
B.Value = Inventory.Inv[Plr.UserId]["Currency"]["Candy"]
local A = Instance.new("StringValue", Plr)
A.Name = "Backpack"
A.Value = EquippedPack(Inventory.Inv[Plr.UserId]["Inventory"]["Backpack"])
end
end
end
EquippedPack = function(Backpacks)
for i,v in pairs(Backpacks) do
if v[3] == true then
return i
end
end
end
game.Players.PlayerAdded:Connect(function(Plr)
Inventory.CreateData(Plr)
CreateValues(Plr)
end)

3 comments
Where did you parent the script?
Server script service, folder.
the rest is working fine tho.