so basically I have 143 items and I want to randomly give the player five of these items when they spawn, but I can't figure it out. Right now the script does nothing for some reason. Right now it's in Starter Character Scripts.
What I have so far:
local Rstore = game.getservice("ReplicatedStorage")
local count = 0
local p = game.players.localplayer
while count >= 5 do
r = math.random(1,143)
local Item = Rstore:GetChildren()
local chosenItem = Item[math.random(1,143)]
local GiveItem = chosenItem:Clone()
GiveItem.parent = p.Backpack
count = count + 1
end

1 comment
Im not very good at scripting in general, so sorry if this doesn't help but, isn't players supposed to be Capitalized like "Players" and local players as "LocalPlayer"?