I was trying everything I could think of, and nothing work, could someone please tell me what’s wrong with this code? The error is: attempt to index nil (table) with ‘naame’ (part of table) (Line 128)
local replicatedStorage = game:GetService("ReplicatedStorage")
local DogeSkinsFolder = replicatedStorage:FindFirstChild("DogeSkins")
local Events = replicatedStorage:FindFirstChild("Events")
local Parent = Events:FindFirstChild("Parent")
local TakeAway = Events:FindFirstChild("TakeAway")
-- Normal = White
--Rare = Blue
--Super Rare = Red
--Legendary = Yellow
--Godly = Dark Purpel
local SkinDoges = {
GalaxyDoge = {
Img = "http://www.roblox.com/asset/?id=12529836139",
Name = "Galaxy Doge",
Rarity = "Godly",
ColorCode = "Godly",
naame = "GalaxyDoge"
},
RedDoge = {
Img = "http://www.roblox.com/asset/?id=12529665792",
Name = "Red Doge",
Rarity = "Legendary",
ColorCode = "Legendary",
naame = "RedDoge"
},
SparkleTime = {
Img = "http://www.roblox.com/asset/?id=12526506473",
Name = "Sparke Time Doge",
Rarity = "Super Rare",
ColorCode = "Super Rare",
naame = "SparkleTime"
},
Amethyst = {
Img = "http://www.roblox.com/asset/?id=12432132041",
Name = "Amethyst Doge",
Rarity = "Rare",
ColorCode = "Rare",
naame = "Amethyst"
},
Frost = {
Img = "http://www.roblox.com/asset/?id=11550564067",
Name = "Frost Doge",
Rarity = "Normal",
ColorCode = "Normal",
naame = "Frost"
}
}
local RarityTable = {
Normal = {
SkinDoges["Frost"],},
Rare = {
SkinDoges["Amethyst"],},
SuperRare = {SkinDoges["SparkleTime"],
},
Legendary = {
SkinDoges["RedDoge"],},
Godly = {
SkinDoges["GalaxyDoge"],
}
}
--[[ Normal = SkinDoges["Frost"],
Rare = SkinDoges["Amethyst"],
SuperRare = SkinDoges["SparkleTime"],
Legendary = SkinDoges["RedDoge"],
Godly = SkinDoges["GalaxyDoge"]]
local Rarities = {
Normal = 50;
Rare = 33;
SuperRare = 11;
Legendary = 5;
Godly = 1
}
script.Parent.MouseButton1Click:Connect(function()
local leaderstats = plr.leaderstats
local DogeCoins = leaderstats.DogeCoins
if DogeCoins then
if DogeCoins.Value >= 10000 then
local RandomNumber = math.random(1,100)
local counter = 0
local total = 0
for i, v in pairs(Rarities) do
print(v)
total += v
end
local function getRandomItem()
local r = math.random(1, total)
local add = 0
for item, v in pairs(Rarities) do
if r > add and r <= add + v then
return item
end
add += v
end
end
local item = getRandomItem()
warn(item)
warn()
local thereal = math.random(1,#RarityTable[item])
warn(Rarities)
warn(RarityTable)
warn(item)
warn(SkinDoges)
warn(thereal)
local thereallyreal = SkinDoges[thereal]
Parent:FireServer(thereallyreal ,thereallyreal["naame"], plr.DogeSkins)
--[[for rarity, weight in pairs(Rarities) do
counter = counter + weight
if RandomNumber <= counter then
local RarityTable = RarityTable[rarity]
local chosenPet = RarityTable[math.random(1, #RarityTable)]
Parent:FireServer(chosenPet ,chosenPet["naame"], plr.DogeSkins)
end
end--]]
else
print("You cannot buy :(")
end
end
end)```