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

How do I give a random player a tool?

Does anybody know a script that can give a random player a tool,but the other players get nothing?

3 answers

✓ Accepted answer

local ItemToGive =   game.Lighting.Sword
local player = math.random(1, game.Players.NumPlayers);
local Players = game.Players:GetPlayers()

ItemToGive:Clone().Parent = Players[player]

3 comments

0

Ok,But where do I put the tool?

0

in the lighting... The tool has to be named sword unless you change the sword bit on line 1

0

Ok thanks :D!

local ItemToGive = game.Lighting.Tool
local player.math.random(1, game.Players.numPlayers);
local Players = game.Players:Getplayers()


ItemToGive:Clone().Parent = Players [Player]
--give tools stuff to player and give tool
print("Tool given to random player!")

1 comment

0

Local Needs To be There.

local player = math.random(1, game.Players.NumPlayers);
for i,p in pairs(game.Players:GetPlayers()) do
	if i==player then
		--give tool stuff
	end
end

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