Unknown global variable in modulescript

So here is my issue.

I’m placing my main menu camera rotation physics in a modulescript because I have been addicted to using them but here is when the issue lies. Since it’s not a global variable but local one… in a normal localscript this camera would well… work normally because the local cameraRotate variable within the function is available anywhere within that scope… but with modulescripts I can’t have that because it gives me an error like this and I can’t reference it. If there is a way to bypass this then that would be phenomenal… other wise should I just place it anywhere else?

And as well I am using this in a modulescript because I just generally like having all of this stuff organised in modulescripts that have intended functions to them than having one script with a tonne of messy code and if it errored then yeah screw that.

The camera rotate cant be in the thing

-- line 41
local cameraRotate
cameraRotate = runService.RenderStepped:Connect(function(deltaTime)
1 Like

Okay that fixed my issue fast. I’ll keep that in mind that next time when I am scripting stuff like this. Thanks!

You can’t reference a variable inside of itself. Make it void first.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.