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

How do i put a specific tool into players?

Asked by 4 years 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 369 — 4y
0
No this is just for local players BrownieXPopTxrt 5 — 4y
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 1055 — 4y
0
I don't understand this, is this for a player when they join in. Also is there any other script FluffySheep46209 369 — 4y

2 answers

Log in to vote
0
Answered by 4 years 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 4 years 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