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

How do you only give certain people tools on your game? [closed]

Asked by 9 years ago

I am trying to only give certain people tools when they enter my game but it's not working. Does anyone know how to do it? Thank in advance!

~Veloxityx3x

Closed as Not Constructive by Goulstem and Shawnyg

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
0
Answered by
funyun 958 Moderation Voter
9 years ago
admins = {"Player", "Veloxityx3x"} --Add more if you want
tool = nil --Replace nil with the tool


game.Players.PlayerAdded:connect(function(player)
    for _, v in pairs(admins) do
        if player.Name == v then
            player:WaitForChild("Backpack")
            tool:Clone().Parent = player.Backpack
        end
    end
end)

So, we begin with a table of admin names. We then make a variable for the tool. Then, we need to start a function for when a player is added. PlayerAdded passes an argument to the connected function that is the player that joins. We then look through the admin name table. If the player's name is one of those admin names, we will... 1) Wait for his Backpack. When players join, you usually have to wait for their stuff to load before you can access it. 2) Clone the tool, and put it in the backpack. Bingo.

Ad