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

How do I clone a tool into a players backpack? [Solved]

Asked by
Osamiku 12
3 years ago
Edited by Ziffixture 3 years ago

I'm trying to clone a tool from ReplicatedStorage into a players backpack with a command

when I type the command in the script runs through but the receiving player doesn't get the tool.

Here is the script:

commands.give = function(sender, arguments)

    print("Give Classup command fired by "..sender.Name) 

    local playerToGiveClassupTo = arguments[1]
    local toolToGiveToPlayer = arguments[2]

    if playerToGiveClassupTo then
        local plr = findPlayer(playerToGiveClassupTo)

        if plr then 
            local backpack = plr:WaitForChild("Backpack")
            local cloneTool = game.ReplicatedStorage.classup:Clone()

            cloneTool = plr.Backpack
            print(playerToGiveClassupTo.." was given ".. toolToGiveToPlayer) 

        end
    end
end


there aren't any errors in the output but no tool is in my inventory.

the command is ":give (Player name) classup" and the tool "classup" is in ReplicatedStorage.

any solutions?

edit: also this is just a section of the script showing this command only. all my other command scripts work fine.

1 answer

Log in to vote
0
Answered by
Osamiku 12
3 years ago
Edited 3 years ago

sorry for the inconvenience, I just solved it by adding a parent to the tool line.

here for anyone who had the same problem:

cloneTool.Parent = plr.Backpack
0
No inconvenience created, you're fine :) AntoninFearless 622 — 3y
Ad

Answer this question