Im fairly new to scripting; messy code that i came up in my head because im too small brain to think of a simpler way
game:GetService('Players').PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
local Player = game.Players.LocalPlayer
local number = math.random(1,4)
if number == 1 then
wait(6)
print(1)
local gear = workspace.Folder.ClassicSword:Clone()
gear.Parent = Player
elseif number == 2 then
wait(6)
print(2)
local gear = workspace.Folder.RedHyperLaser:Clone()
gear.Parent = Player
elseif number == 3 then
wait(6)
print(3)
local gear = workspace.Folder.HyperlaserGun:Clone()
gear.Parent = Player
elseif number == 4 then
wait(6)
print(4)
local gear = workspace.Folder.Epicsword:Clone()
gear.Parent = Player
end
end)
end)
end)

7 comments
thanks
thanks
wait it says attempt to index nil with backpack (i moved folder to serverstorage and changed code so its in server storage and its a script)
local player does not exist on server, you already have variable for player on line 1, just remove line 5 and change all references of Player to player
ohhhh ok
ohhhh ok
thanks to both of you