when I buy the second boombox i shoul have the tool correctly but the boombox mesh don’t match , I want to make when you buy the second tool automatically removed the tool and mesh of the first boombox, because when I buy another boombox tool is deleted but the mesh is not removed.
I don’t know if this is understandable
Script
local OldtoolName = "1# Feathers Texture BB"
local ReplaceTool = "2# Gold Texture BB"
local ClickDetector = script.Parent
local Price = 5700
local Lighting = game:GetService("Lighting")
local Tool = Lighting:WaitForChild(ReplaceTool)
local DB = false
ClickDetector.MouseClick:Connect(function(plr)
if plr.leaderstats.Cash.Value >= Price and not plr.Backpack:FindFirstChild(ReplaceTool) and not DB then
DB = true
if plr.Backpack:FindFirstChild(OldtoolName) then plr.Backpack[OldtoolName]:Destroy() end
Tool:Clone().Parent = plr.Backpack
plr.leaderstats.Cash.Value -= Price
wait(2)
DB = false; -- ignore any warnings saying global DB is only used in the enclosing function
end
end)
Bruh I answered this for you but ok
First, put the gold mesh in the tool, and name it mesh. Not in the handle, in the Tool named 2# Gold Texture BB.
Then put this script in the cd.
local OldtoolName = "1# Feathers Texture BB"
local ReplaceTool = "2# Gold Texture BB"
local ClickDetector = script.Parent
local Price = 5700
local Lighting = game:GetService("Lighting")
local Tool = Lighting:WaitForChild(ReplaceTool)
local DB = false
local Mesh = Tool:WaitForChild("Mesh") -- make sure it is named mesh
ClickDetector.MouseClick:Connect(function(plr)
if plr.leaderstats.Cash.Value >= Price and not plr.Backpack:FindFirstChild(ReplaceTool) and not DB then
DB = true
if plr.Backpack:FindFirstChild(OldtoolName) then plr.Backpack[OldtoolName]:Destroy() end
Tool:Clone().Parent = plr.Backpack
plr.leaderstats.Cash.Value -= Price
if plr.Character:FindFirstChild("RadioC") then plr.Character.RadioC.back.Mesh:Destroy(); mesh:Clone().Parent = plr.Character.RadioC.back end
wait(2)
DB = false; -- ignore any warnings saying global DB is only used in the enclosing function
end
end)