I need the script only to run if the item (Black Glowstick) is not in their inventory
local clickdetector = script.Parent.ClickDetector clickdetector.MouseClick:Connect(function(player) game.ServerStorage["Black Glowstick"]:Clone().Parent = player.Backpack end)
You can check with :FindFirstChild()
if the item exists in the backpack. However make sure to also check if the item exists within the player his character. Equipped tools are moved to the character so they can be shown in the workspace.
local clickdetector = script.Parent.ClickDetector clickdetector.MouseClick:Connect(function(player) if player.Backpack:FindFirstChild("Black Glowstick") or player.Character:FindFirstChild("Black Glowstick") then return end game.ServerStorage["Black Glowstick"]:Clone().Parent = player.Backpack end)
Basically, it checks if the player has the item already and also checks if the player has equipped the item, it won't give the item to the player again.