I have this function:
function Camera2.ToggleGrain(Status)
TvGrain.Visible = Status
end
And I am calling it like this:
CameraModule2:ToggleGrain(false)
The TvGrain is invisible:

But for some reason it makes it visible:
https://gyazo.com/f91459b1efda73b59cdfea1834756c48
I don’t know why.
Blockzez
(Blockzez)
2
Because value:method() is the same as value.method(value), and CameraModule2 evaulates to true.
Why are you using : as you don’t need to pass CameraModule2 as an argument?
1 Like
Thanks it works but what do you mean by:
When you use:
CameraModule2:ToggleGrain(false)
You are passing self as a parameter, which means:
CameraModule2.ToggleGrain(CameraModule2, false)
Therefore you should make the function like so:
function Camera2.ToggleGrain(self, Status)
TvGrain.Visible = Status
end
If you aren’t going to use the self parameter, you should avoid using it.
1 Like
You aren’t using self, therefore you shouldn’t use thing:function(), rather use thing.function().
1 Like
Oh I see, I did a print(status and I was wondering why it was printing a table id.