I am working on a game and basicly its a lobby. players get in the game and after like at least 5 players have joined, the game should start. I want a random player to be given a specific costum made sword (already scripted) that they will later on use to kill the victims. I need a script to give the sword to a random player. Please HALPPPP.
This isn't a request site, but since you sound new, I'll help you.
local numb = 0 function upd() numb = #game.Players:GetChildren() end upd() local sword = -- put your sword here lol -- ex: local sword = game.ServerStorage.Sword game.Players.PlayerAdded:connect(function(p) -- someone has joined, so update the number count. upd() end) repeat wait() until numb >= 5 -- now, there are atleast 5 people in the game. local random = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren)] sword:Clone().Parent = random.Backpack -- at this point the player has the specific weapon
This script could have been smaller but I had not thought of it.
Next time please atleast try :)
Happy scripting!
Closed as Not Constructive by DeceptiveCaster and starmaq
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?