Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Tool wont get cloned to both backpack and starterGear fix?

local price = 9 -- The price of your item.
local db = true
 
script.Parent.ClickDetector.MouseClick:connect(function(player)
    if player.leaderstats.Cash.Value >= price then
        player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - price
        db = false
        script.Parent.BrickColor = BrickColor.new("Bright red")
		game.ReplicatedStorage.WoodPickaxe:Clone().Parent = player.StarterGear and player.BackPack
        wait(0.5)
        script.Parent.BrickColor = BrickColor.new("Bright green")
        db = true
    end
end)

how do i fix it i tried with game.ReplicatedStorage.WoodPickaxe:Clone().Parent = player.StarterGear and player.BackPack

but then the script doesnt work so i need to choose if i cant find a solution player startergear then i get the tool but first when i die player backpack then i get the tool instant but lose it when i die

2 answers

This is not how the ‘and’ operator works. Simply use two lines to parent it to both.

local pickaxe = game.ReplicatedStorage.WoodPickaxe
pickaxe:Clone().Parent = player.StarterGear
pickaxe:Clone().Parent = player.Backpack

Also, the ‘p’ in Backpack is not supposed to be capital.

1 comment

0

thank you very much

Make sure the tool has archivable true, if it isn't make it true because if it is false then it'll return nil instead of a cloned instance of the tool.

This discussion is preserved as it was. New answers, comments, and votes are closed.