This is the code i am currently messing with. I can’t know how does this even works.
The code is just this.
:DoSomething()
Why this won’t make any errors?
How does this even work?
This is the code i am currently messing with. I can’t know how does this even works.
The code is just this.
:DoSomething()
Why this won’t make any errors?
How does this even work?
Im guessing since you are never declaring what the function does it doesnt do anything so what you are telling the code is litteraly nothing. If you try print(DoSomething()) it will probably return nil. i havent tested this tough
Is this a full code or just one single line of the code?
from what i’ve understood its the full code
also when you dont have anything before the function call you dont need the " : "
I just tested this with 3 type of script, and when I loaded in, only a server script printed out error.
I dont know why the LocalScript and ModuleScripr didnt give any errors, bc in the script redactor, there really was an error
thats weird. i understand why modules doesnt give an error (unless you loaded the module in another script) but the fact that server gives an error but not client is weird
Probably the code really does nothing, since even if I made a function DoSomething, it still does nothing
In the LocalScript
I will try to do that in server script
Server script still gives error but not the LocalScript. The LocalScript doesn’t even work even if i type in print
where is it located? (the local script). cause its pretty weird that it doesnt work at all?
In the workspace
I dont think it will work even if i put it somewhere else
local scripts dont run in workspace- place it in startergui, replicatedfirst, startercharacter or starterplayer. (there might be more options idk) [EXCEPTION: They can run if inside a players character]
It did work in replicated first, but not in replicated storage
I didnt check startergui, starter scripts, etc.
If the guy doesn’t give more context, then we dont know what to do
Probably it is the solution that localscripts doesnt work in workspace
I can only say that the same exact code i saw in TopbarPlus
Icon.new()
:setLabel(“blablabla”)
Its not supposed to work in replicated storage since its [“Storage”]
Also Icon.new works there since icon is a declared variable (prob a table)
so guys, what I meant is why it doesn’t throw any error when theres nothing on the back of the function. im fine with whatever the function does, im just curious that it doesnt throw anything like “Incomplete statement: expected assignment or a function call”
( my problem is within only one line of code " :DoSomething() " )
Because you are able to write your code in multiple lines. If your code simply contains :DoSomething()
, it will give you a different syntax error.
You can technically do this and it will work just fine:
local
someCondition
=
true
if
someCondition
then
print
"true"
end
local Module = {}
function
Module
:
DoSomething
()
print("ya")
end
Module
:DoSomething()
I hate that this is valid and possible, it hurts my eyes and soul.
bro what did you do to the funcctions and variables are they ok
Assuming that the script is able to run, there has to be other parts of the code immediately prior to the function line.