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

Tool not moving to backpack?

Asked by
TudiPYM 12
3 years ago

Made a code to move a tool to the players backpack if they had a specific name, it doesn't want to work.

game.Players.PlayerAdded:Connect(function(player)
    if player.Name == "TudiPYM" then
        local register = game:GetService("ServerStorage"):WaitForChild("Black Registry")
        local clone = register:Clone()
        clone.Parent = player.Backpack
    end
end)

This is a script inside of ServerScriptService.

0
can you put a print at the start of the function? if it doesn't print, ill give an answer, if it doesnt ill try Xapelize 2658 — 3y
0
and it doesn't print, so the event doesnt work, where should I put the script? TudiPYM 12 — 2y

2 answers

Log in to vote
0
Answered by 3 years ago
clone.Parent = player.StarterGear
0
WORKED! THANK YOU! TudiPYM 12 — 2y
Ad
Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago
Edited 3 years ago

You can probably try this way.

game.Players.PlayerAdded:Connect(function(player)
    for i,v in next,game.Players:GetPlayers() do
        if player.Name == "TudiPYM" then
            local register = game:GetService("ServerStorage"):WaitForChild("Black Registry")
            local clone = register:Clone()
            clone.Parent = player.Backpack
            end
    end
end)
0
Still didn't work TudiPYM 12 — 2y

Answer this question