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

How do I give a random player a tool?

Asked by 9 years ago

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

3 answers

Log in to vote
1
Answered by
RM0d 305 Moderation Voter
9 years ago

local ItemToGive = game.Lighting.Sword local player = math.random(1, game.Players.NumPlayers); local Players = game.Players:GetPlayers() ItemToGive:Clone().Parent = Players[player]
0
Ok,But where do I put the tool? DerpTrollark 20 — 9y
0
in the lighting... The tool has to be named sword unless you change the sword bit on line 1 RM0d 305 — 9y
0
Ok thanks :D! DerpTrollark 20 — 9y
Ad
Log in to vote
-1
Answered by 9 years ago
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!")
0
Local Needs To be There. iluvmaths1123 198 — 9y
Log in to vote
-3
Answered by 9 years ago
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

Answer this question