Tbh, I have no idea why this errors, I get 14:37:24.519 Workspace.Store.Checkout.DeleteItem.Script:4: attempt to index nil with 'Destroy' - Server - Script:4
Here is the most basic script in the world…
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildWhichIsA("IntValue") then
wait(0.2)
hit.Parent:Destroy()
else
print("nope")
end
end)
I am working on a shop system where you pick up items off the shelf, place them on the conveyor belt, they get rung up, you buy them then they get added to your inventory…Help…
Prob cause there’s no debounce?
local DB = false
script.Parent.Touched:Connect(function(hit)
local IntCheck = hit.Parent:FindFirstChildWhichIsA("IntValue")
if IntCheck and not DB then
DB = true
wait(0.2)
hit.Parent:Destroy()
DB = false
else
print("nope")
end
end)
Yay! It worked! One small problem, new error…
14:49:35.614 Workspace.Store.Checkout.DeleteItem.Script:4: attempt to index nil with 'FindFirstChildWhichIsA' - Server - Script:4
May wanna check for any potential other low-suspicious errors:
local DB = false
script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChildWhichIsA("IntCheck") and not DB then
DB = true
wait(0.2)
hit.Parent:Destroy()
DB = false
else
print("nope")
end
end)