#I cant figure out this error

1 messages · Page 1 of 1 (latest)

steel coyote
#

Im trying to get a random tool to a player everytime they click a part but it doesnt seem to working and im not sure why. I cant figure out what the error means either.


local commonFolder = game:GetService("ReplicatedStorage").Catchables.Common
local uncommonFolder = game:GetService("ReplicatedStorage").Catchables.Uncommon
local rareFolder = game:GetService("ReplicatedStorage").Catchables.Rare
local legendaryFolder = game:GetService("ReplicatedStorage").Catchables.Legendary


local function onClicked(player)
    local random = math.random(1,4)
    print(random)
    local backpack = player.Backpack
    if random == 1 then
        local randomCommon = commonFolder[math.random(1,#commonFolder)]:Clone()
        randomCommon.Parent = backpack
    else if    random == 2 then
            local randomUncommon = uncommonFolder[math.random(1,#uncommonFolder)]:Clone()
            randomUncommon.Parent = backpack
    elseif random == 3 then
            local randomRare = rareFolder[math.random(1,#rareFolder)]:Clone()
            randomRare.Parent = backpack
    elseif random == 4 then
            local randomLegendary = legendaryFolder[math.random(1,#legendaryFolder)]:Clone()
            randomLegendary.Parent = backpack
    end
    end
    end

ClickDetector.MouseClick:Connect(onClicked)```
bright rapids
#

am lazy

#

oh

#

u forgot

#

:GetChildren()

#

folder is a folder

#

so it cant have size

steel coyote
steel coyote