#Modulescript working in studio but not in game

102 messages · Page 1 of 1 (latest)

vocal mirage
#

self variables are nil in game but they work in studio, both the script and modulescript are in server script service and the runcontext is server, i tried using legacy it didnt work

iron grail
#

Why are you using VS Code to code in Roblox? Unless... You are exploiting, right?

flat drift
#

Or rojo

thin anchorBOT
#

studio** You are now Level 21! **studio

flat drift
#

(I don't think he exploits since it is a server script)

iron grail
#

How you know it is a server script?

flat drift
iron grail
#

Oh... yea

#

You can't access ServerScriptService in client, right?

flat drift
#

Yes

vocal mirage
#

its rojo

#

why would i exploit in my own game

iron grail
#

You are so funny embarrassedman

grizzled flume
#

If so you need to run the function and save the metatable to a variable and use that variable to run :UpdatePower

vocal mirage
#

no

#

the module returns a function

#

that inits and returns a metatable

#

that contains the functions itself

#

and self

grizzled flume
#

I see

#

Then you need to do module()

vocal mirage
#

i do that

grizzled flume
#

I see

grizzled flume
vocal mirage
#

no

#

thats within the toggle function

#

its run by Setup

grizzled flume
#

Can you send that part of the script

vocal mirage
#

as part of the setup to toggle all the switches to the default value

grizzled flume
#

So toggle is in the module?

vocal mirage
#

yes

grizzled flume
#

Setup isn’t nil right?

vocal mirage
#

no it cant be nil its a function

#

in the metatable

grizzled flume
#

ik

#

I’m just making sure

vocal mirage
#

k

grizzled flume
#

Have you tried printing self?

vocal mirage
#

no i can try that rn

#

actually

#

ill try smth else

grizzled flume
#

You can also try printing the metatable

vocal mirage
#

k so

#

self isnt nil but its empty

#

i tried printing the table but it just prints the id or whatever

#

so i print the unpack as a tuple

#

and its empty so yeah

grizzled flume
#

Dang

#

Never gotten this issue

vocal mirage
#

this is what it looks rn, not showing the actual scripts unless its required

grizzled flume
#

Also btw did you do __index just incase?

thin anchorBOT
#

studio** You are now Level 2! **studio

vocal mirage
grizzled flume
vocal mirage
grizzled flume
vocal mirage
#

no i tested it rn

#

as you can see works fine in studio

#

the table printed is self

grizzled flume
#

So it works?

vocal mirage
#

in studio

#

not in game

grizzled flume
#

Did you publish?

vocal mirage
#

yes....

grizzled flume
#

Try publishing again

vocal mirage
grizzled flume
#

Now you wait

vocal mirage
#

ill test it rn

grizzled flume
#

For sometime

vocal mirage
#

k

#

still dosent work for now ill wait some 10 mins

grizzled flume
#

It’s like this error

#

💀

vocal mirage
#

k 11 minutes

#

i hate this

grizzled flume
#

What’s in setup again?

vocal mirage
#

well i cant share the whole function but the error comes from this line

#

well thats the function that causes it

#

actual error comes from here

vocal mirage
#

i gtg now bye

thin anchorBOT
#

studio** You are now Level 5! **studio

vocal mirage
#

it still dosent fucking work 👍

grizzled flume
#

Average Roblox L

#

Try making the same thing but minimal version

#

Same logic and stuff but without all the switches

vocal mirage
#

ill just not use oop

#

ill have the table stored on the server and have it passed every call