#how is this function causing everything below it ask like its not even there
1 messages · Page 1 of 1 (latest)
what isn't wrong with this function
😭
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...?
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
as for the rest of the function use a table bruh
how would i use a table?
like so: local tbl={}
"the script is very optimised"
"the design is very human"
Fr 
oh my god
is there no other way to code this
rather than putting 7000 elseifs
🤷♂️
look into loops and tables im begging you 😭
I use loops and tables but idk how this could be done with a loop or a table
yeah the problem is that the variables the function equipD() takes aren't very good for tables and loops
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
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
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
yeah i don't think he'll get this
if you dont get this simple thing then thats just sad