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

Get touching parts is not working for my ore generation script, why?

I'm making a game called minecraft, and I'm working on ore generation, so I thought I could do a thing where it gets all the stone and if a random number is 1, then turn it into ore. But when I try to get the surrounding parts, nothing happens even thought its a 1 out of 3 chance of each surrounding part turning into coal, I tried making an empty .Touched event that gets disconnected immediately so that there's a touch interest but it still didn't work. I also notice the the coal generation runs while the stone is being filled in even though there is no wait() in the stone filling loop.

function coalthingy(coal)
	for i,x in pairs(coal:GetTouchingParts()) do
		if math.random(1,3) == 2 and x.Name == "Stone" then
			for i,v in pairs(x:GetChilden()) do
				if not v:IsA("TouchTransmitter") then
					v.Texture = "rbxgameasset://Images/rock_coal"
				end
			end
			if math.random(1,3) == 3 then
				coalthingy(x)
			end
		end
	end
end

The entire script if you need it

1 answer

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