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

How do you delete a tool you cloned and gave to a player?

Asked by 6 years ago
local player = game.Players.LocalPlayer
local Cash = player:WaitForChild("leaderstats"):WaitForChild("Tokens")
local price = 0

local weapon = game:GetService("ReplicatedStorage").Fists

local info = script.Parent:WaitForChild("Info")

local bought = false
local equipped = false



script.Parent.MouseButton1Click:connect(function()

    if bought == true then
        if equipped == true then --uniquiping
            info.Text = "OWNED"
            equipped = false
        else
            info.Text = "EQUIPPED" -- Equiping
            equipped = true
            local clone = weapon:Clone()
            clone.Parent = player.Backpack
        end

    else
        Cash.Value = Cash.Value - price --buying
        info.Text = "OWNED"
        bought = true
    end
end)

how do i delete the tool i just gave when you uniquip it

1 answer

Log in to vote
1
Answered by 6 years ago

try putting in the destroy function. so once they unequip it if the script's parent is the tool then do script.Parent:Destroy()

0
OK EpicAshtonTheBoy 33 — 6y
Ad

Answer this question