I'm making a tycoon. I have 3 scripts: Furnace Script

function destroy(hit) 
    if hit.Name == "drop" then
	    hit:Destroy()
    end
end

workspace.PartStorage.drop.Touched:connect(destroy)

Main Script

partStorage = Instance.new("Model", workspace)
partStorage.Name = "PartStorage"

Drop Script

wait(2)
workspace:WaitForChild("PartStorage")
  
while true do
    wait (1)
    local drop = Instance.new("Part", workspace.PartStorage)
    drop.Name = "drop"
    drop.Size = Vector3.new(1, 1, 1)
    drop.Position = script.Parent.Position
end

The problem is, that when I want to destroy ores, it's showing "drop is not a valid member of Model" in output. When I check "PartStorage" model, there are "drop" parts in it.

3 comments

0

Are these all Server Scripts?

0

.Touched only works when a player touches it, use :GetTouchingParts() and iterate it, and with that, then delete the part

0

Greatneil80, can you show me an exemple how should I write it?