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

Tool not cloning into backpack from ReplicatedStorage with script?

Asked by 6 years ago

When I use this script


game.Players.PlayerAdded:Connect(function(player) for i,v in pairs(game.Players:GetChildren(player)) do local someone = v:WaitForChild(player) print(someone) if someone == "The_sandwic" then game.ReplicatedStorage.Keycard:Clone(someone.Backpack) end end end)

It find the player "The_sandwic" but when I run it it doesn't clone the tool into the backpack. Can someone help?

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

I'm not sure if this would work, but here.

game.Players.PlayerAdded:Connect(function(player)
    for i,v in pairs(game.Players:GetChildren(player)) do
    local someone =  v:WaitForChild(player)
        print(someone)
        if someone == "The_sandwic" then
                game.ReplicatedStorage.Keycard:Clone().Parent = someone.Backpack
        end


end


end)
0
why does he use 'for i,v in pairs(game.Players:GetChildren(player)) do' when he already has the player... decla123 45 — 6y
0
shhhhh Conquesias 85 — 6y
Ad

Answer this question