If someone can give/make exactly what I need ill gladly pay, but any help is appreciated, very very new to coding. Im making a game and I need a gear that on use disappears from the player and will give them a random item(both backpack and starterkit) out of a named folder in the Replicated Storage. I also want it take make a sound on activation. The closest thing I can find is the "Random gear giver" free model, however this does not receive the items from the Replicated Storage so I cannot use it. I have gears to put in and an attempt that doesn't work I can show aswell.
Its giving the error -
" Players.OoDerpzoO.Backpack.SwordPack.Script:10: attempt to index nil with 'GetChildren' "
My current scrap pile of code is
local Tool = script.Parent
local RS = game:GetService("ReplicatedStorage")
local Folder = RS:WaitForChild("CommonSwords", 50)
local Players = game:GetService("Players")
function onActivated()
local Tools = Folder:GetChildren()
local Table = Tool
local chosenTools = {}
local selected = math.random(1,#Table)
table.insert(chosenTools,Table[selected])
table.remove(Table,selected)
local player = Players:GetPlayerFromCharacter (character)
for i, v in pairs (chosenTools) do
Folder:FindFirstChild(v.Name):Clone().Parent = player.Backpack
end
end
Tool.Activated:connect(onActivated)
