#how is this function causing everything below it ask like its not even there

1 messages · Page 1 of 1 (latest)

sick spear
#

when the function isnt there all the prints work but when it is there the last print doesnt work

lost saddle
#

what isn't wrong with this function

sick spear
#

😭

lost saddle
# sick spear

follow your closures, which is where you open a section of code that needs to be closed with an end

#

your code is: lua thing:connect(function() -- _outer_function_not_shown function WHY_NO_WORKY() print("the magic schrodingers print") end end) and you're asking why no worky, is no worky.

you then remove the function, and its end, now your code is this:

thing:connect(function() -- _outer_function_not_shown
  --function WHY_NO_WORKY()
  --end

  print("the magic schrodingers print")
end)``` and are confused by this...?
sick spear
#

so u say that print is in the function

#

so it dont print

#

u smart

#

that was the issue on why it was not printing

lost saddle
#

as for the rest of the function use a table bruh

sick spear
#

how would i use a table?

lost saddle
dusk osprey
#

my eyes have cancer

#

from looking at the script

shy jay
#

"the script is very optimised"

idle wind
#

"the design is very human"

tame ginkgo
#

Fr crying

sinful ingot
#

is there no other way to code this

#

rather than putting 7000 elseifs

sick spear
shy jay
sick spear
shy jay
dusk osprey
#

vro just make a table that has all the rarities and the things in it

#

like lid

#

then make it loop

#

and check blah blah

#

like

shy jay
# dusk osprey and check blah blah

every condition takes diffrent variables for equipD() to make this better i think he would also have to rewrite the function that takes these variables.
He could also make a table to map the function calls but that would just be the pretty much same outcome as these many if statements

dusk osprey
#

im not even gonna lie just do something that uses strings

#

like if it has rare

#

and check what number it is

#

nvm its the same thing i lied

#

oh wait i got it now

#

just make a for loop of like

#
for i=1, 9 do
    if canister=="Rare"..i then
    equipD("rare"..i, "bottom"..i",glass"..i, "lid"..i) --idk how your script works so imma just do this
    elseif then
    end
end
#

thats all you need to do

#

if theyre an actual object then just do this

#
for i=1, 9 do
    if canister=="Rare"..i then
    local rare=idkwhatfolder:FindFirstChild("Rare" .. i)
    local bottom=idkwhatfolder:FindFirstChild("bottom" .. i)
    local glass=idkwhatfolder:FindFirstChild("glass" .. i)
    local lid=idkwhatfolder:FindFirstChild("lid" .. i)
    equipD(rare, bottom,glass,lid) --idk how your script works so imma just do this
    elseif then
    end
end
shy jay
dusk osprey
#

if you dont get this simple thing then thats just sad