This is suppose to give plays on spawn random weapon can you please tell me whats wrong with it?
player = part.Parent:findFirstChild("Humanoid") function onPlayerEntered(player) local Item = game.Lighting:FindFirstChild(math.random) Item:clone().Parent = player.Backpack wait(2) print 'Working' end game.Players.PlayerAdded:connect(onPlayerEntered) onPlayerEntered(game.Players:WaitForChild("Player1"))
Judging by your attempt, the items are in game.Lighting. So if its not please PUT EM THERE. Use this. It will put it in their backpack NOT their startergear so if they die they dont obtain it again but if you want them to just keep spawning random items when they spawn reply with a yes and ill come up with a quick script :D
function GiveWeap(des) local items = game.Lighting:GetChildren() items[math.random(1,#items)]:Clone().Parent = des.Backpack end game.Players.PlayerAdded:connect(function(plr) plr:WaitForChild("Backpack") GiveWeap(plr) end)
At the top 'findFirstChild' is supposed to be FindFirstChild. You also have two player variables. You may need to change one of the variables to something else. 'Item:clone()' should be Item:Clone(). Other than that I don't know, sorry.
Locked by fireboltofdeath and Articulating
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?