Why won't this work? I want to give each player a random item on spawn.
Gives a random player an item when they spawn. Out of these four items. Rewrite the script if nessecary.
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(chr)
local hk = Instance.new("BoolValue", plr)
hk.Value = false
hk.Name = "HoldingKnife"
local m = 0
repeat
wait()
if hk==true then
local hum = chr:FindFirstChild("Humanoid")
if hum then
hum.Died:connect(function()
hk.Value = false
end)
end
return
else
hk.Value = true
local o = math.random(1,4)
if o==1 then
local clone1 = game.Lighting.Blade:Clone()
clone1.Parent = plr.Backpack
elseif o==2 then
local clone2 = game.Lighting.Bombos:Clone()
clone2.Parent = plr.Backpack
elseif o==3 then
local clone3 = game.Lighting.DualKnives:Clone()
clone3.Parent = plr.Backpack
elseif o==4 then
local clone4 = game.Lighting.InsaneKnife:Clone()
clone4.Parent = plr.Backpack
end
end
until m==10
end)
end)

3 comments
Seems interesting, shouldn't the square bracket have a closing bracket too though?
oh yeah lol... thnx for spooting that... I must have press ] so fast that I didnt even press it and just went on to Enter... lol
also, wat u mean interesting? lol