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

How do make it so when a certain specified player joins it gives them a tool?

Sorry to bother everyone again, i have made my kick brick and added the code that a member here gave me, now i want to know how to make it so no one can get the tool except the specified user. So i want to be able to put multiple usernames that can receive the tool but no one else can. Can someone help

-- ****Sorry for the bother again everyone, Im quite new therefor I dont really know much about lua (but i would like to learn how to code, but i cant teach myself)

Thanks, i really appreciate it!

7 comments

0

i would recommend alvinblox tutorials or the following website:

0

studioplus.io

0

ok i wil try that

0

So the brick is a tool? If so, do you want the tool to go into their inventory when the tool is touched?

0

oh no i want it so when the player that i have specified has joined it will automatically give them the tool

0

i found the answer, dont worry

0

oh ok lol

2 answers

✓ Accepted answer
local part = --Define the tool
local player = game:GetService("Players") --Defines the Player Service
local plr = player.LocalPlayer [[-- Gets the player who is playing the game (i dont know how to explain this lol)--]]
local backPack = game.player:FindFirstChild("Backpack") [[--This is where all guns, tools and stuff are stored. This defines the place where all of this is stored--]]

local function kickOrGive() -- Define the function that will run when it is called
	if plr.Name = "07jwv07" or plr.Name = "Lightning_Game27" then [[--If the players name is 07jwv07 or Lightning_Game27 then the below will run--]]
		part.Parent = backPack -- Puts the part in the backPack
	else -- If players name is not the above then
		plr:Kick("Reason for kicking player") -- Kicks the player!
	end
end

part.Touched:Connect(kickOrGive) -- Fires the function when the part is touched

Hopefully this helped!

1 comment

0

Thanks! If my code does not work i will try urs

Its alright! I found some code that will help

i just searched and someone asked the same question

game.Players.PlayerAdded:Connect(function(plr) local character = game.Workspace:WaitForChild(plr.Name) if plr.Name == "07jwv07" then local g = game.ServerStorage.Tool:Clone() g.Parent = plr.Backpack end end)

2 comments

0

Well if anyone needs it, then its here

0

oh... i spent like 5 mins of my time writing the answer below lol

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