Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to choose one random player?

I was wondering if anyone could give me a script in where it chooses one random player in the game, and then gives them a certain tool/item if they are picked. I am currently making a game and it would really help a bunch!

^u^

1 comment

0

This site isn't a place to ask for free scripts. Make an attempt with your own code for help.

1 answer

Here you go I guess?

local function giveRandomPlayerTool(tool)
	if not game:GetService("Players") or #game.Players:GetChildren() < 1 then return end

	local randomPlayer = game.Players[math.random(1,#game.Players:GetChildren())]

	local toolClone = tool:Clone()
	toolClone.Parent = randomPlayer.Backpack
end

1 comment

0

-1 for not giving an explanation at all.

This discussion is preserved as it was. New answers, comments, and votes are closed.