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

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

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

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.

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