#Egg hatching not working?

25 messages · Page 1 of 1 (latest)

ember vapor
#

not sure why not, (I've only worked in python and java in the past).

timid scaffold
ember vapor
#

yeah but it's not explaining it well enough for me to understand

#

Players.zg13t.PlayerGui.ScreenGui.Frame.TextButton.Script:6: Expected 'then' when parsing if statement, got '='

timid scaffold
#

like in python assignment (=) and comparison (==)

ember vapor
#

oh is that the same in lua

timid scaffold
#

python : == ; lua : ==

#

python : != ; lua : ~=

ember vapor
#

ah, thank you

timid scaffold
#

btw

#

pet == 1 or 2 doesn't mean pet == 1 or pet == 2

ember vapor
#

hmm?

timid scaffold
#
local pet = "blabla"

if pet == 1 or 2 then
  -- always true
  print("mh")
else
  print("nop")
end
#

your condition is (condition_1) or (condition_2)

#

with condition_1 -> (pet == 1)

#

and condition_2 -> (2)

#

but 2 is always true

#

and to finish, hash ~= Hash

#

it's case sensitive

#

Hatch is underline because not define

sterile minnow
#

also @ember vapor at the end there see how Hatch is underlinded blue it means that the script sees it as undefinded

#

so change it to hatch

ember vapor
#

k

sterile minnow
#

instead of Hatch

fresh marten
#
local coins = 500

function hatch()
    if coins > 499 then
        local pet = math.random(1,6)
        if pet == 1 or pet == 2 or pet == 3 then
          print("common")
        end
        if pet == 4 or pet == 5 then
            print("rare")
        end
        if pet == 6 then
            print("legendary")
        end
    end
end