D
D
Dima2021-08-17 13:26:16
Lua
Dima, 2021-08-17 13:26:16

Which operator to enter so that it is if by (number) more?

local energy = game.Players.LocalPlayer.leaderstats.energy
local lvl = game.Players.LocalPlayer.leaderstats.lvl
local country = game.Players.LocalPlayer.leaderstats.country
while wait(2) do
  if energy.Value == 100 then
    lvl.Value += 1
  end
  if lvl.Value == 10 then
    country.Value +=1
  end
end


I want that if the energy was 100 more, then the lvl would appear at + 1. In my case, it just sees only the first number 100, but does not see 200, 300.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2021-08-18
@dollar

Operator: >(more).
And in Lua there is no operator +=unfortunately. This language is positioned as the simplest, without these programming hieroglyphs, understandable only to them.

The code will be like this:
local energy = game.Players.LocalPlayer.leaderstats.energy
local lvl = game.Players.LocalPlayer.leaderstats.lvl
local country = game.Players.LocalPlayer.leaderstats.country
while wait(2) do
  if energy.Value > 100 then --если энергии больше 100
    lvl.Value = lvl.Value + 1
  end
end

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question