local tool = player.Backpack:FindFirstChild("Sword")
if tool then
tool:Destroy()
endlocal tool = player.Character:FindFirstChild("Sword")
if tool then
tool:Destroy()
endlocal function removeTool(player, toolName)
local backpackTool = player.Backpack:FindFirstChild(toolName)
if backpackTool then
backpackTool:Destroy()
end
if player.Character then
local characterTool = player.Character:FindFirstChild(toolName)
if characterTool then
characterTool:Destroy()
end
end
endscript.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.RemoveTool:FireServer()
end)game.ReplicatedStorage.RemoveTool.OnServerEvent:Connect(function(player)
local tool = player.Backpack:FindFirstChild("Sword")
if tool then
tool:Destroy()
end
end)script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local tool = player.Backpack:FindFirstChild("Sword")
if tool then
tool:Destroy()
end
end
end)