Prob 1 Module code did not return exactly one value Prob 2 Requested module experienced an error while loading
Script 1:
local Skinmodule = {}
Skinmodule.pets = {
["Legendary"] = {
game.ReplicatedStorage.Skins:WaitForChild("Why")
};
["Epic"] = {
game.ReplicatedStorage.Skins:WaitForChild("Thin3")
};
["Rare"] = {
game.ReplicatedStorage.Skins:WaitForChild("Thing2")
};
["Uncommon"] = {
game.ReplicatedStorage.Skins:WaitForChild("Thing")
};
["Common"] = {
game.ReplicatedStorage.Skins:WaitForChild("Wooden")
};
}
Skinmodule.rarities = {
["legendary"] = 5;
["Epic"] = 10;
["Rare"] = 15;
["Uncommon"] = 30;
["Common"] = 40;
}
Skinmodule.chooseRandomSkin = function()
local counter = 0
local randomNumber = math.random(1, 100)
for rarity, weight in pairs(Skinmodule.rarities) do
counter = counter + weight
if randomNumber <= counter then
local rarityTable = Skinmodule.Skin[rarity]
local chosenSkin = rarityTable[math.random{1, #rarityTable}]
return Skinmodule
end
end
end
Script 2
local SkinModule = require(game.ServerScriptService:WaitForChild("RarityScript"))
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if player.leaderstats.Cash.Value >= 500 then
local Skin = SkinModule.." selected"
game.ReplicatedStorage.OpenCrate:FireClient(player,Skin)
end
end)

1 comment
what what?