New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How do i put a specific tool into players?

Asked by 14 days ago

So i want to put a specific tool into players but how would i do that

this is what i got:

for i,v in pairs(game.Players:GetChildren()) do 
    if (v:IsA("Key card")) then 
    v.Parent = game.Players.LocalPlayer.Backpack
    end
    end
    wait(0.5)
0
Would this be to all players FluffySheep46209 36 — 14d
0
No this is just for local players BrownieXPopTxrt 0 — 14d
0
and v in that case is a player and nothing else and the script needs to be server sided for when a character is added if its not for everyone, if its for everyone then just put in starterpack Gameplayer365247v2 859 — 14d
0
I don't understand this, is this for a player when they join in. Also is there any other script FluffySheep46209 36 — 14d

2 answers

Log in to vote
0
Answered by 14 days ago

Put the item in StarterPack which you want every player to have, and when they join they will get given whatever you put in StarterPack. You are over complicating it.

Ad
Log in to vote
0
Answered by 14 days ago

Hi, there are several problems with your existing script, first its a local script which makes the tool invisible to others & and since it is there is no use for using i, v in pairs(). Second of all, you do if (v:IsA("KeyCard")) then. There is no roblox part called KeyCard, you would have to use "if v.Name == "KeyCard" then. Third of all, a tool cant be a member of players So do this and it should work

local keycard = game.Workspace.Keycard
for i, v in pairs(game.Players:GetChildren()) do 
if v:IsA("Player") then
keycard:Clone().Parent = v.Backpack
end
end

Answer this question