-
What do you want to achieve? I want to fix the error at line 21 but I do not know how to fix it
-
What is the issue? There’s a error in line 21 that I’m not able to fix
-
What solutions have you tried so far? I’ve looked for solutions but nothing helps!
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local lootable = require(game.ServerStorage:WaitForChild("EmoteTable"))
local Emotes = game.ServerStorage.Emotes
function GetRandomItem()
local Sum = 0
for SwordName,Chance in pairs(lootable) do
Sum += Chance
end
local RandomNumber = math.random(Sum)
for SwordName,Chance in pairs(lootable) do
if RandomNumber <- Chance then
return SwordName
else
RandomNumber -= Chance
end
end
end
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Item = Emotes:FindFirstChild(GetRandomItem()):Clone()
Item.Parent = Player.Backpack
end)
end)
![]()