Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
3

Why does the '#' act like comments '--'?

Asked by 6 years ago

I was looking at a few scripts 'in studio', and I stumbled upon this type of code that kind of acted as a comment. But it has a red line under it, why does the # act as a comment? Here's an example of how it's used;

#script.Parent = nil --As you'll see, it's green [in studio] just like this comment turns this green
0
Are you trying to make joke? YasuYoshida 171 — 6y
2
The # symbol is mainly used to get the number of something, usually in a table. Since "script.Parent" is not a number value of some sort, it will error, which is the cause of the red line. As for the green text, I have no idea. Discern 1007 — 6y
4
I actually just tested this and it seems that # DOES turn text green when used on the very first line. On any other line, however, it works normally. I have no idea why this would be... Perci1 4974 — 6y
5
I don't really know anything about this, but here's what I know: The # symbol creates a stand-alone interpreter. If there is a # in the first line, the script ignores it. This allows the use of Lua as a script interpreter in the Unix system. I don't think you can use this in ROBLOX, and I just searched this up. You can find more here: http://www.lua.org/pil/1.4.html Discern 1007 — 6y
1
It seems to me that it would be some sort of preprocessor, but I can't find any documentation on such a feature. It's probably a bug in the syntax highlighter, unless it's used by the CoreScripts. adark 5461 — 6y

1 answer

Log in to vote
-7
Answered by 6 years ago

let's say i wanted to run the script smoothly in output, but keep the script from breaking, you'd insert this in certain lines, Witch i call them a substitute for "BreakPoints." Like this

#script.Parent = nil

local Instance.new("Hint")
Hint = game.Workspace.Hint
Hint.Text = 'Hello World'
Hint.BackGroundcolor = 255,255,255
Hint = true
Hint = Hint.Transparency

#While Hint do#
Hint = 0
wait(0.5)
Hint = 0.1
wait(0.5)
Hint = 0.2
wait(0.5)
Hint = 0.3
wait(0.5)
Hint = 0.4
wait(0.5)
Hint = 0.5
wait(0.5)
Hint = 0.6
wait(0.5)
Hint = 0.7
wait(0.5)
Hint = 0.8
wait(0.5)
Hint = 0.9
wait(0.5)
Hint = 1
wait(0.5)
#end#
0
There is still a red line under the first '#'. :/ TheeDeathCaster 2319 — 6y
Ad

Answer this question