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

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

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

✓ Accepted answer

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

1 comment

0

OK

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