So I am not sure if this even belongs here but here I go:
I am so sorry to those whose eyes are bleeding from this piece of code and I am with you too. I know that if statements aren’t necessarily “bad” but they aren’t very friendly to the human eyes. It hurts to look at this and I want to know if there is an efficient way of trying to clean this bloody mess?
(also what I am trying to do is that I check the level and rebirth and increase a stat cap)
ame.Players.PlayerAdded:Connect(function(player)
player:WaitForChild("Data").Level.Changed:Connect(function()
if player:WaitForChild("Data").Level.Value > 1000 and player:WaitForChild("Data2").Rebirth.Value == 0 then
player:WaitForChild("Data").Level.Value = 1000
elseif player:WaitForChild("Data").Level.Value > 2000 and player:WaitForChild("Data2").Rebirth.Value == 1 then
player:WaitForChild("Data").Level.Value = 2000
elseif player:WaitForChild("Data").Level.Value > 3000 and player:WaitForChild("Data2").Rebirth.Value == 2 then
player:WaitForChild("Data").Level.Value = 3000
elseif player:WaitForChild("Data").Level.Value > 4000 and player:WaitForChild("Data2").Rebirth.Value == 3 then
player:WaitForChild("Data").Level.Value = 4000
elseif player:WaitForChild("Data").Level.Value > 5000 and player:WaitForChild("Data2").Rebirth.Value == 4 then
player:WaitForChild("Data").Level.Value = 5000
elseif player:WaitForChild("Data").Level.Value > 6000 and player:WaitForChild("Data2").Rebirth.Value == 5 then
player:WaitForChild("Data").Level.Value = 6000
elseif player:WaitForChild("Data").Level.Value > 7000 and player:WaitForChild("Data2").Rebirth.Value == 6 then
player:WaitForChild("Data").Level.Value = 7000
elseif player:WaitForChild("Data").Level.Value > 8000 and player:WaitForChild("Data2").Rebirth.Value == 7 then
player:WaitForChild("Data").Level.Value = 8000
elseif player:WaitForChild("Data").Level.Value > 9000 and player:WaitForChild("Data2").Rebirth.Value == 8 then
player:WaitForChild("Data").Level.Value = 9000
elseif player:WaitForChild("Data").Level.Value > 10000 and player:WaitForChild("Data2").Rebirth.Value == 9 then
player:WaitForChild("Data").Level.Value = 10000
elseif player:WaitForChild("Data").Level.Value > 11000 and player:WaitForChild("Data2").Rebirth.Value == 10 then
player:WaitForChild("Data").Level.Value = 11000
end
end)
player:WaitForChild("Data2").Resilience.Changed:Connect(function()
if player:WaitForChild("Data2").Resilience.Value > 40 and player.Data2.Rebirth.Value == 0 then
player:WaitForChild("Data2").Resilience.Value = 40
elseif player:WaitForChild("Data2").Resilience.Value > 50 and player.Data2.Rebirth.Value == 1 then
player:WaitForChild("Data2").Resilience.Value = 50
elseif player:WaitForChild("Data2").Resilience.Value > 60 and player.Data2.Rebirth.Value == 2 then
player:WaitForChild("Data2").Resilience.Value = 60
elseif player:WaitForChild("Data2").Resilience.Value > 70 and player.Data2.Rebirth.Value == 3 then
player:WaitForChild("Data2").Resilience.Value = 70
elseif player:WaitForChild("Data2").Resilience.Value > 80 and player.Data2.Rebirth.Value == 4 then
player:WaitForChild("Data2").Resilience.Value = 80
elseif player:WaitForChild("Data2").Resilience.Value > 90 and player.Data2.Rebirth.Value == 5 then
player:WaitForChild("Data2").Resilience.Value = 90
elseif player:WaitForChild("Data2").Resilience.Value > 100 and player.Data2.Rebirth.Value == 6 then
player:WaitForChild("Data2").Resilience.Value = 100
elseif player:WaitForChild("Data2").Resilience.Value > 110 and player.Data2.Rebirth.Value == 7 then
player:WaitForChild("Data2").Resilience.Value = 110
elseif player:WaitForChild("Data2").Resilience.Value > 120 and player.Data2.Rebirth.Value == 8 then
player:WaitForChild("Data2").Resilience.Value = 120
elseif player:WaitForChild("Data2").Resilience.Value > 130 and player.Data2.Rebirth.Value == 9 then
player:WaitForChild("Data2").Resilience.Value = 130
elseif player:WaitForChild("Data2").Resilience.Value > 140 and player.Data2.Rebirth.Value == 10 then
player:WaitForChild("Data2").Resilience.Value = 140
end
end)
end)