I made this long script, and it only works in studio....
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)

1 comment
Well i did put the code that you said on top of the local script, but it didnt work.