I have a program that is supposed to delete the weapon in hand and delete from starter gear when a button is pressed. It deletes from the hand properly, but when I reset, the weapon appears again. This makes me believe that it wasn't deleted from starter gear. What is the issue?
local function onCreatePartFired(player, tool)
local SG = player.StarterGear
if tool then
local sg_tool = SG:FindFirstChild(tool.Name)
if sg_tool then
print("hey")
SG:FindFirstChild(tool.Name):Destroy()
end
tool:Destroy()
end
end
local Players = game:GetService("Players")
plr = game:GetService("Players").LocalPlayer
char = plr.Character or plr.CharacterAdded:Wait()
script.Parent.MouseButton1Click:Connect(function()
local tool = char:FindFirstChildOfClass("Tool")
onCreatePartFired(plr,tool)
end)

1 comment
for debugging purposes, "hey" is being print when I run the program