Hi there! There may obviously be a few of these that you already knew, if not all. I’m not claiming to be a pro at all by posting this. I’m just wanting those out there that are struggling with a few annoying aspects of developing in Roblox Studio to be able to bypass those struggles like I wasn’t able to at first. So, without further ado, here are a few tips and tricks that I’ve learned in Roblox Studio.
1) This is a rather new one for me. But I noticed in some advanced scripters’ YouTube videos that they were commenting out entire sections of code with what seemed to be the click of a button. I found out that you can actually do this by highlighting a section of code, then pressing CTRL + “/”.
2) Another great one is UIAspectRatioConstraints. I didn’t find about about these until this month (9 months into my coding journey). They keep your gui objects in a specific ratio. So they come in handy when used in plugins like AutoScale Lite. But they can also be used to just keep your images square if you insert one into that image. UICorners are also a thing, so you don’t have to use the old plugins for adding rounded corners.
3) If you don’t know what “return” is in lua, or coding in general, LEARN IT! That was probably one of the biggest things holding me back as a scripter in the beginning. It will help you out tons if you understand that from the get-go.
4) When hovering over a model you can hold down ALT to select parts inside of it. It’s a good idea though to just avoid this when unnecessary (by using folders instead of models).
5) Get the Reclass plugin. It’s very useful for changing lots of objects to different objects while maintaining their children and properties.
6) Holding down CTRL while scaling items will scale that axis of the object equally on both sides instead of one. Also, hotkeys for moving, building and resizing are much faster than clicking between them; CTRL + 1, CTRL + 2, CTRL + 3.
7) If you’re experienced at all then you also know that when it comes to coding, the answer is almost never what you expect. The best thing I’ve found to fix bugs after hours of looking it over and re-printing / re-writing code to get a different point of view on the problem. A good way to do this is by asking someone in the Unofficial Roblox server in their #development-help channel. If all else fails, I’ll post a detailed explanation of my problem on the Dev Forum. Doing those three things will almost always solve your problems. If not, sleep on it and hopefully it will come to you.
8) You can store multiple local variables on the same line by using commas such as in this example:
local var_1, var_2 = "blue", "purple"
You can also write things on the same line after defining a variable (and in general):
local var_1 = "blue"; var_1 = "purple"
9) Instead of using spawn() (because of reasons) use:
task.spawn(function()
-- code here
end)
This will wrap a function in a coroutine and call it at the same time because of the “()” at the end. It does the exact same thing that spawn() tries to do, just without the negative side effects.
10) When you want to replace lots of words / phrases that are the same with one new word or phrase, hit the command CTRL + F while in a script. It’s called find and replace. Very nice if you haven’t been using it yet.
11) You can make conditions into bool values (or anything into bool values) by putting a “()” around it. This is especially useful for gui cases like this:
local pages
local tabs
for _, tab in pairs(tabs:GetChildren()) do
-- given that each tab and designated page name are the same..
tab.MouseButton1Down:Connect(function()
for _, page in pairs(pages:GetChildren()) do
-- you can do this
page.Visible = (page.Name == tab.Name)
-- instead of
if page.Name == tab.Name then
page.Visible = true
else
page.Visible = false
end
end
end
end
12) And lastly viruses. Oh boy I’ve had my fair share. If your game is literally freezing at the start and you have no idea what’s causing it, there’s probably a backdoor somewhere. A good way to find and remove this is by using the binoculars,
and using the drop down arrow to select “Script Only” and look for suspicious key words like getfenv or require (if they’re not yours). Another way to see right away if a free model script is suspicious is if you find something like this (found in the common boombox):
And yea that’s most of the stuff I can think of right now. Please let me know what you thought by replying to this topic, thanks!