Random things I've learned

Out of my three years of developing, there is lot’s of things I have learned. I’m going to share a lot with you today.

1: WorldRoot:Raycast() is faster than WorldRoot:GetPartsInPart()

2: If you want to know when a button is pressed and let go, then use GuObject.GuiState

3: Do most of your input on the client, and DON’T USE GuiButton.MouseButton1Click. Use .Activated on a client script instead. MouseButton1Click only works on computers.

4: If you can use a ModuleScript to encapsulate it, then encapsulate it.

5: Use variables and simplify your code.

6: Disconnect your useless connections to save memory.

7: Try to do all code related with UI on the client.

8: Try to make your UI usable for mobile too. Try using things such as UIAspectRatioConstraint.

9: Do you need some assets? Try Krita (for artwork) and Blender (for 3D models). Most of you probably already know this

10: Want to get a random item from a table? Do

local randomitem = yourtable[math.random(1, #yourtable)]

11: Want to get the up look vector? Here’s how:

local upvector = yourCframe.UpVector

12: TweenService is not like a terribly hard service that will kill your time. DON’T YOU DARE DO IT MANUALLY!! Here’s how to use it:

local TweenService = game:GetService("TweenService")

local part = Instance.new("Part")

local params = TweenInfo.new(3, Enum.EasingStyle.Linear)

local properties = {
    Transparency = 1
}

local newtween = TweenService:Create(part, params, properties)

newtween:Play()

This code will make a part go from fully opaque to fully transparent in three second. Here’s some info on TweenInfo and the ‘newtween’.

13: Use Selection when you’re developing. Open the command bar and then select an object and type in the command bar something like

print(game:GetService("Selection"):Get()[1].CFrame) 

and then look at the output.

List will continue…

Feel free to add anything!! Anything you’ve learned that might be helpful for others?

25 Likes