What does : do (not functions)

Hello,

I’ve come across “:” when defining variables and learning from other scripts. Is it like redefining a variable?

Code example:

local PlayerSettings: Configuration = Player:WaitForChild("Settings")

(main focus is ’ PlayerSettings: Configuration’ )

1 Like

It is just type annotation you can learn more about them here Type Checking

(also its not redefining)
for example 2 is a number

so

local mynumber : number = 3
local myString : string = "imstring"
3 Likes

To add on to this, you need to put --!strict at the top of your script in order to enable typechecking, otherwise it will just do nothing

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.