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

How to give players tools using scripts?

Asked by 9 years ago

Hey guys! I'm making a game and I need some code that would give every player in the game a certain tool (From lighting preferably)

Any help?

1 answer

Log in to vote
0
Answered by 9 years ago

Are you trying to give every player currently in-game a tool at a given moment? If so, simply iterate over game.Players and clone the tool into everyone's Backpack, like so:

for _,player in ipairs(game.Players:getChildren()) do
 local tool = game.Lighting.YourToolNameHere:clone()
 tool.Parent = player.Backpack
end
0
I do have a question. at "yourtoolnamehere" is it the id or name legoson7 70 — 9y
0
Just the name of the thing in Lighting (Although I personally would use ReplicatedStorage instead of Lighting, but that's a long story). iconmaster 301 — 9y
Ad

Answer this question