So I have a grave Part that turns transparent when I click the ClickDetector attached to it, but only If I have a shovel tool in my Backpack. The problem is that if I click the Part and not have the shovel in my Backpack, I can pick up the shovel after clicking the Part and the Part still turns transparent even tough I clicked it before picking up the shovel. I have attached a video so its easier to understand:
I’m trying to make it so that if you pick up the shovel after clicking the grave Part, the Part doesn’t turn transparent and you have to click the grave Part again to turn it transparent
robloxapp-20230624-1323167.wmv (3.8 MB)
Here is my script:
game.Workspace.graveyard.gravevdig.ClickDetector.MouseClick:Connect(function(plr)
local shovel = plr:FindFirstChild("Backpack"):WaitForChild("sho")
if shovel then
game.SoundService.creepysound:Play()
game.Workspace.graveyard.gravevdig.Transparency = 1
game.Workspace.graveyard.gravevdig.CanCollide = false
game.ReplicatedStorage.GraveText:FireAllClients(20)
wait(6)
game.SoundService["fast wind woosh sound effect"]:Play()
if not shovel then
print("no shovel")
end
end
end)