Why isn't this rain script working properly?

Please try this, if this doesn’t work I estimate it may be something to do with your end

local rainspawned = 3

while true do
	if rainspawned >= 100 then
		break
	end
	rainspawned = rainspawned + 1
	wait()
	local Rain = Instance.new("Part", game.Workspace)
	Rain.Size = Vector3.new(0.5,2,0.5)
	Rain.Position = Vector3.new(0,15,0)
	Rain.Transparency = 0.5
	Rain.Anchored = false
end

print("No More Rain")

No. I only have 1 script trying to break that loop. The script spawns the part and everything.

@MistakenScopeZ The print at the very bottom works, but the rain just keeps on going.

I feel like its definitely a problem on your end. I tested it and it works flawlessly.

1 Like

Perhaps you should try restarting studio. The code we’re suggesting to you works fine on our end.

Ok. I’ll try restarting it. Also, this is the video:

yes this script work for me too

1 Like

Oh, my gosh. I still restarted studio and it still doesn’t work. The print is still getting outputted, but the parts that are falling are not stopping.

Do you mind sending a place file of your game so we can look into it ourselves?

1 Like

Practicing Code.rbxl (30.6 KB)

You have another script creating the parts in an infinite while loop, which is the Instancing script. If you disable that, everything should be fine. I knew it… so my hypothesis was correct.

image

3 Likes

I see whats wrong… u got ur script named “Instancing” which generates block for ever, so the block actaully stops but u cant see the difference because of the other blocks spawning by the other script

Oh, my. I should’ve known that. He used the same script, but erased what he had in it. I should changed the name. Ok, let me change the name and I’ll see.

changed the name? u should delete the whole Instancing script

Don’t change the name, the name doesn’t matter at all – disable the script

Wow, you’re a life saver. I guess I learned something as well. Thank you very, very much. I feel bad for taking time out of your day fixing a pointless problem.

I disabled it instead of changing the name.

So this whole time you had another script that you wren’t aware of wow.

I knowwwwww. It’s such a stupid mistake. I mean, I just started scripting about a week ago. I’m still learning how to script Lua on Roblox.

Oh thats okay I don’t blame you since you only started a week ago.

2 Likes