I am trying to make a script where a part, which has a value in it, goes into a tunnel gets deleted and another part spawns, it doesn't seem to work, and I can't tell why it won't. Can anyone tell me what I am doing wrong?
function mold()
local part = script.Parent.Candy:Clone()
part.Parent = game.Workspace
part.Anchored = false
part.Transparency = 0
end
function Delete(cat)
if cat:FindFirstChild("Value") then
cat:Destroy()
mold()
end
end
script.Parent.Molder.Touched:connect(Delete())
``

2 comments
You do not need the extra parenthesis on "Delete" in your connection line.
On line 8, you have the argument/parameter 'cat'. In the terms you're using it, you're using it incorrectly. I recommend defining the variable cat within the function, and deleting the argument