What do you want to achieve? Keep it simple and clear!
Remove the error message for coin collecting
What is the issue? Include screenshots / videos if possible!
The coins work fine. Just want the error messages to go.
A bool value for the debounce is inside the coin.
if hit.Name == "Coin" then
local db = hit.collect
if db.Value == true then
db.Value = false
hit.Transparency = 1
script.Sound:Play()
hit:Remove()
Is this what you meant? If not, i’m sorry for being a banana.
if hit.Name == "Coin" then
local db = hit:FindFirstChild("collect")
if hit.collect.Value == true then
hit.collect.Value = false
hit.Transparency = 1
script.Sound:Play()
hit:Remove()
if hit.Name == "Coin" then
local db = hit:FindFirstChild("collect") -- Instead of being an error, it will equal `nil` if there is now collect thing.
if db and db.Value == true then -- Before it checks if the value is true, it checks if it exists at all.
db.Value = false
hit.Transparency = 1
script.Sound:Play()
hit:Remove()