I'm pretty new to lua coding and I do not know any function or something that can detect if something is a local script?
So, how would we detect if an item is a local script?
2 answers
We can use the built-in Roblox function, :IsA, which basically outputs true or false if the ClassName of the part/script matches or doesn't match the ClassName we want. Since LocalScripts have a ClassName of 'LocalScript', all localscripts will output a true value when using :IsA("LocalScript")
For example,
localscript = script
print(script:IsA("LocalScript"))
Outputs "true", whereas using
gui = script.Parent
print(gui:IsA("LocalScript"))
Outputs false.
You can read more about ClassNames here: https://developer.roblox.com/en-us/api-reference/property/Instance/ClassName
And the :IsA function here: herehttps://developer.roblox.com/en-us/api-reference/function/Instance/IsA
Hopfully that helps.
Roblox has a simple in-build function to check if an instance is a given class:
if item:IsA("LocalScript") then
print("This is a LocalScript")
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
this isnt an answer but i hope somehow it helps lead you there, i can somehwhat understand your question, im new to this as well. from my understanding its possible that if a script starts out with a colored word that says local and sentences after that means its a local item until you see the word end, any underlines in a script means an error except for the word workspace