local sword = game.Lighting.LinkedSword
local ClickDetector = Instance.new("ClickDetector")
ClickDetector.Parent = script.Parent
ClickDetector.MouseClick:connect(function(player)
if not player.Backpack:FindFirstChild(sword.Name) and not (player.Character and player.Character:FindFirstChild(sword.Name)) then
sword:Clone().Parent = player.Backpack
end
end)
Its supposed to give the first person who clicks it the item "LinkedSword" from lighting, then it disables the brick so it doesnt give it to anyone else, then it checks the game to see if someone has it in their backpack, if no one has it in their backpack it enables the brick again for the other person. I mean it sort of works, but when I click it, it gives me the tool, and wont let me click it again, but it will give other players the tools even if someone has the item in their backpack. Can someone fix it so only one person gets the item then it disables the brick so no one else can get it but then if the player loses the item or does not have it, it enables itself again? I wanted to use boolean but wasn't sure how, thanks!

3 comments
It works, like when the person clicks it it wont allow anyone else click it, but when that person removes the item from their inventory, it just disables the whole script forever and wont let anyone get the sword if no one has it
I edited it, read it now.
Thanks!:-)