All RemoteEvents Fired at Once

UIS.InputBegan:Connect(function(input,isTyping)
	if isTyping then 
		return
	elseif input.KeyCode == Enum.KeyCode.B then
		if TurnedOn == true then return end
		if Buso.Value > 5 then
			print("B fired")
			Remote:FireServer("Tier1")
			if Buso.Value > 8 then
				TurnedOn = true
				Remote:FireServer("Tier2")	
				elseif Buso.Value > 8.5 then
					print("Tier 3 fired")
					Remote:FireServer("Tier3")	
					TurnedOn = true
					elseif Buso.Value > 9 then
						Remote:FireServer("Tier4")	
						TurnedOn = true
						wait(Buso.Value)
						TurnedOn = false
					end
				end
			end
		--end
	--end
end)

Problem:
When you have a busovalue they all fire at once. The first remote event, second, and third all fire at one time.

What do I want?
I want only one to fire at once. For example, if your buso value is at 8.7 then only the second remote event should fire. The third remote event shouldn’t fire since you don’t have enough. The first one should not fire either.

Organize your if statements and don’t include them in the same hierarchy.

First of all, there’s an if statement where elseif should be. It would fire two remotes at once. Indentation is important to be able to read the statements to which scope they belong in.

Second of all, reorder the structure from highest to lowest. Or else it’ll just fire the lowest value at all times. The expectation is to fire the highest. Even though they meet the requirements, it will always fire the lowest.

Finally, this is vulnerable to exploits if the exploiter managed to fire either Tier1, Tier2, etc. To counteract this, you need to restructure it into firing to the server with no value at all, letting the server to read the value directly.

3 Likes