Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My furnace script is not working it wont destroy ores?

function destroy()
	game.Workspace.drop:Destroy()
end
game.Workspace.drop.Touched:connect(destroy())

I made sure my ore names are drop and all I thought could be wrong can someone tell me what is wrong with my script?

1 answer

✓ Accepted answer

Firstly, connection statements take in the function that will execute when the event fires. You called the destroy function inside of the connection line.. don't do that. Just list the function name.

Secondly, workspace.drop is a direct indexation of that exact part. In order to detect the part that hit the dropper, you need to setup a Parameter for the Touched event.

Parameters resemble what is returned from the event. Touched events return the part that touched.

function destroy(hit) --'hit' parameter is now the part that touched!
	if hit.Name == "drop" then --Check the hit's name.
		hit:Destroy()
	end
end

workspace.drop.Touched:connect(destroy)

This discussion is preserved as it was. New answers, comments, and votes are closed.