Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How do I make a script that will give a SPECIFIC iteam to a random player? [closed]

Asked by 5 years ago

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.

0
this is not a request site, learn first, do an attempt, if it doesn't, we will be more than happy to help you fix it starmaq 1290 — 5y

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?

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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!

0
clear answer good job starmaq 1290 — 5y
Ad