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

Tool wont get cloned to both backpack and starterGear fix?

Asked by 2 years ago
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

Log in to vote
0
Answered by
jundell 106
2 years ago
Edited 2 years ago

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.

0
thank you very much thedukke1 9 — 2y
Ad
Log in to vote
0
Answered by
danklua 72
2 years ago

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.

Answer this question