I would like to make the item different every time that they respawn and each player has a different set of items.
I found this code but it is not working: Item1 = game.Lighting.ItemName Item2 = game.Lighting.ItemName Item3 = game.Lighting.ItemName Items = {Item1, Item2, Item3}
SpawnItem = Items[math.random(#Items, 1)] SpawnItem:clone().Parent =
thanks in advance!
Make sure that this is a server script.
local Items = game.Lighting:GetChildren() game.Players.PlayerAdded:Connect(function(player) local SpawnItem = Items[math.random(1, #Items)]:Clone() SpawnItem.Parent = player.Backpack end)
parent the item to the thing u want it to be in
and replace the item names, you can also always add more stuff u want to spawn.
input whatever items u want to clone
local SpawnItem = math.random(1, 3) if SpawnItem == 1 then Item1:clone() Item1.Parent = elseif SpawnItem == 2 then Item2:clone() Item2.Parent = elseif SpawnItem == 3 then Item3:clone() Item3.Parent = end