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

Simple rain script. 'end' expected (to close 'while' at line 3) near 'elseif'?

It's a really simple rain script, however I'm new to this.

Here's the script

if game.Lighting.TimeOfDay > "04:00:00" then
for i = 1, 10 * 100000 do
	while true do
		wait()
	part = Instance.new("Part", game.Workspace)
	part.Transparency = 0.4
	part.BrickColor = BrickColor.new("Toothpaste")
	part.Size = Vector3.new(.5,1.75,.5)
	part.CanCollide = false
	part.Material = "Neon"
	part.Position = Vector3.new(math.random(-100,100), 100, math.random(-100,100))
	wait()
elseif
	game.Lighting.TimeOfDay < "04:00:00" 
	~= nil then 
		end
	end
end

The error is: 'end' expected (to close 'while' at line 3) near 'elseif' I can't seem to fix it.

1 answer

✓ Accepted answer

Hello there, It appears you are missing a end to close the instructions. Properly indenting can really help you out in finding what you are doing wrong! :)

while true do
	if game.Lighting.TimeOfDay > "04:00:00" then
   	 for i = 1, 100 do
       		part = Instance.new("Part", game.Workspace)
       		part.Transparency = 0.4
       		part.BrickColor = BrickColor.new("Toothpaste")
       		part.Size = Vector3.new(.5,1.75,.5)
       		part.CanCollide = false
       		part.Material = "Neon"
      		part.Position = Vector3.new(math.random(-100,100),10,math.random(-100,100))
       	 wait()
   	 end 
	end
	wait()
end

2 comments

0

Thank you, however how do I make it stop "raining" then? I've tried multiple solutions but can't seem to get it working. Such as between 04:00:00 to 12:00:00 it's raining, and 13:00:00 to 03:00:00 it stops.

0

I've made the current edits in my original answer.

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