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

I need help with backpacks/equipped tools can anyone help?

Asked by 1 year ago

So basically im trying to make a shop and whenever you buy a trail it adds a trail to a part in the game "tpart" but its a part of a tool and if the tool is equipped its not going to give it the trail because its not in the backpack is there a way to still add the trail

local BuyButton = script.Parent
local plr = game.Players.LocalPlayer
local axefolder = plr:WaitForChild("leaderstats")
local trees = axefolder.Trees

BuyButton.MouseButton1Down:Connect(function()
    if trees.Value >= 10 then
        trees.Value = trees.Value - 10
        local WhiteTrail = Instance.new("Trail")
        WhiteTrail.Parent = plr.Backpack.Tool.Model.tpart
    else
        print("you broke")
    end

end)

1 answer

Log in to vote
0
Answered by 1 year ago

you can try:

BuyButton.MouseButton1Down:Connect(function(player)

end)

and instead of using game.Players.LocalPlayer, just type “player” in the function to define the player that has clicked the button. This should work, otherwise I don’t know what else would.

Ad

Answer this question