How to make Income change on signal while repeating

  1. What do you want to achieve?

I want the value of incoming income to change when the signal is stronger and repeat filling on to the income. image but I can’t find a way for the script to detect when the signal is stronger whilst repeating the income. Ive tried doing the “Repeat until” with “if statments” inside but the script continues with the same income regardless if the signal is changed.

Signal:
image

image

local Parent = script.Parent
local Start = Parent.Start

local Signals = { 

	Weak = Parent.NumberImage.Signals.Signal2,
	Mid = Parent.NumberImage.Signals.Signal3,
	Strong = Parent.NumberImage.Signals.Signal4
	

}

local Upgrades = Parent.Upgrades
local IncomeValue = Parent.NumberImage.IncomeDisplay.Available
local LastRate = Parent.NumberImage.RateNum.LastRate

-- Out Of workspace
local ReplicatedStorage = game.ReplicatedStorage

-- Other

Start.MouseButton1Click:Connect(function()
	
	if Upgrades.Entry.Value == true then -- Entry meaning lvl 1
		print("Starting Money")
		
		repeat
			
			local EntryIncome = math.random(0,10)/10

			IncomeValue.Value += EntryIncome
			LastRate.Value = EntryIncome
			
		until Start["On/Off"].Value == false

		
	end
end)

Put the increment amount into a table indexed by signal strength.

signalIncrement = {
    Strong = 30,
    Mid = 20,
    Weak = 10
}
		repeat
			
			local EntryIncome = signalIncrement[currentSignalStrength] or math.random(0,10)/10

			IncomeValue.Value += EntryIncome
			LastRate.Value = EntryIncome
			
		until Start["On/Off"].Value == false

Something like this.

1 Like

Its okay I found a solution, thank you for trying to help.