This script randomly assigns a weapon to a player each time they spawn. It seems to work as it should, but I keep getting this error: Players.zhendirez.PlayerScripts.LocalScript:7: attempt to index local 'output' (a number value)
I don't get what the problem is, so if someone can explain it, i'd appreciate it. Here's the LocalScript:
--Thanks to LucarioZombie for this local weapons = {game.ReplicatedStorage.Weapons["Tool1"], game.ReplicatedStorage.Weapons["Tool2"]} repeat wait(0.1) until nil ~= game.Players.LocalPlayer.Character local output = math.random(1, #weapons) output.Value:Clone().Parent = game.Players.LocalPlayer.BackPack script:Destroy()
(yes, this is a script someone let me use, i'm just trying to troubleshoot it)
--Thanks to LucarioZombie for this local weapons = {game.ReplicatedStorage.Weapons["Tool1"], game.ReplicatedStorage.Weapons["Tool2"]} repeat wait(0.1) until nil ~= game.Players.LocalPlayer.Character local output = weapons[math.random(1,#weapons)] output.Value:Clone().Parent = game.Players.LocalPlayer.BackPack script:Destroy()