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

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

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

1 answer

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.

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