I'm trying to make it destroy the sword in the backpack.
local Player = script.Parent.Parent.Parent.Parent script.Parent.MouseButton1Down:connect(function(OnClick) if Player.Character:FindFirstChild('Sword') == nil then local TehSword = game.Lighting:FindFirstChild('Sword') TehSword.Parent = Player.Backpack:Destroy() end end)
local player = game.Players.LocalPlayer local objname = "Sword" script.Parent.MouseButton1Down:connect(function(OnClick)-- on click if player.Character then -- checks if theres a character if player.Backpack:FindFirstChild(objname) ~= nil then -- checks if the obj exists in the character player.Backpack:FindFirstChild(objname):remove() -- if its there it will destroy end end)