Hello so can you tell me why the if statement is overlapping eatch other and how to fix it?
playerEnter.Event:Connect(function(number)
if number % 5 == 0 then
workspace.Sounds.Flicker:Play()
room.Blackout(generatedRooms[number])
room.Blackout(generatedRooms[number+1])
task.wait(2)
skull.new(number, generatedRooms)
return
elseif number % 10 == 0 then
workspace.Sounds.Flicker:Play()
room.Blackout(generatedRooms[number])
room.Blackout(generatedRooms[number+1])
task.wait(2)
GreenSkull.new(number, generatedRooms)
end
end)
If statments run in the order in which they are defined, regardless of whether they evaluate to true or false. Your current implementation which you do not want is within func_y in my example, whereas what you want is contained within func_x. Note how the output shows that mod 10 is performed in the output of func_x rather than the mod 5.
They are over lapping, and the fix is to flip the blocks around
if number % 10 == 0 then
workspace.Sounds.Flicker:Play()
room.Blackout(generatedRooms[number])
room.Blackout(generatedRooms[number+1])
task.wait(2)
GreenSkull.new(number, generatedRooms)
elsif number % 5 == 0 then
workspace.Sounds.Flicker:Play()
room.Blackout(generatedRooms[number])
room.Blackout(generatedRooms[number+1])
task.wait(2)
skull.new(number, generatedRooms)
return
elseif number % 10 == 0 then
workspace.Sounds.Flicker:Play()
room.Blackout(generatedRooms[number])
room.Blackout(generatedRooms[number+1])
task.wait(2)
GreenSkull.new(number, generatedRooms)
end
end