I have a problem with a tool (ACS Drink), as the tool still remains in the Player’s parent, visible only on Server side, after the :Destroy() function.
Here’s the script that does the :Destroy()
local Tool = script.Parent
local Player = game.Players.LocalPlayer
local con = nil
local enabled = true
function onEquipped(mouse)
con = mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
function onUnequipped(mouse)
if con ~= nil then
con:disconnect()
end
end
function onButton1Down(mouse)
if not enabled then
return
end
enabled = false
if Player.HungerVal then
if Player.HungerVal.Value + 0 > 100 then
Player.HungerVal.Value = 100
else
Player.HungerVal.Value = Player.HungerVal.Value + 0
end
end
if Player.ThirstVal then
if Player.ThirstVal.Value + 200 > 200 then
Player.ThirstVal.Value = 200
else
Player.ThirstVal.Value = Player.ThirstVal.Value + 200
end
end
wait(2)
Tool:Destroy()
end
Tool.Equipped:connect(onEquipped)
Tool.Unequipped:connect(onUnequipped)
I tried Tool.Parent = nul
, Tool.hmm.Transparency = 1
, doesn’t do anything.