So i made this script and it doesnt work, I did what i could also getting help by other people
repeat wait() until game.Players.LocalPlayer.Character
Player = game.Players.LocalPlayer
Cube = script.Parent
local Workspace = game.Workspace
mouse = Player:GetMouse()
function onEquipped()
Cube.Handle.Equipped:Play()
end
local GearFolder = game.ServerStorage.SwordsFolder
local MovementGearNames = {
"BlackAndWhiteWingedSword",
"BombosSurvivalKnife",
}
function Click()
while true do
for i,v in pairs(GearFolder:GetChildren())do
if v.Name == MovementGearNames[math.random(1, #MovementGearNames)] then
wait(0.01)
v.Enabled = true
local Sound = Instance.new("Sound",script.Parent.Handle)
Sound.SoundId = "rbxassetid://163362522"
Sound.Volume = 1
Sound.Pitch = 1
Sound.Looped = false
Sound.Name = "GearSound"
local Gear = v:Clone()
Gear.Parent = Player.Backpack
Sound:Play()
print(Player.Name,"Got", v.Name.."!")
wait(0.01)
script.Parent:Destroy()
end
end
end
end
Cube.Activated:connect(Click)
Cube.Equipped:connect(onEquipped)

3 comments
It would be helpful if you could describe what it does or doesn't do and what errors occur (if any)
Could you also tell us what it's supposed to do?
Well, What i want it to do is get a random gear wrong a folder and copy it to the players backpack.But i doesnt work but only on studio..