What is this called in LUA?

I searched all around the internet for it and I couldnt find it because I didnt know the name

This is what it looks like. Roblox doesnt know its a humanoid
before

This is what it looks like after adding :Humanoid to the variable. It now holds the properties of a humanoid acting like it is one.

Can anyone tell me what this is called?

Could you be a bit more descriptive? I don’t understand

What you’re referring to is called “type annotations”.

I suggest checking out this topic to learn more about it: Type checking for beginners!

1 Like

I didn’t quite understand the problem, but maybe the thing is that: character = game.Players.LocalPlayer, not a game.Players.LocalPlayer.Character?

Idk i was just wrtiing some lazy code to show u guys an example

Two dots punctuation mark is a type-checking feature that recognizes the properties of the class you paste after it, determines the return types of functions and defines the data types. It mitigates the time you spend looking for its properties or children, going back to take a glance at the return type etc. It’s all handled by the descriptive tab while typing. Examples:

type myTable = {
    ["String"] : string,
    ["Number"] : number
}

local useMyTable : myTable = {
    ["String"] = "Hey",
    ["Number"] = 1
}

local returnElements : () -> (string, number) = function()
    return useMyTable["String"], useMyTable["Number"]
end

print(returnElements()) -- Output: Hey 1

Alright, here we go.

What you are doing here is something called Type Checking, by default roblox doesn’t force you to Type Check, however you can if you want and if you want to get really in-depth with it, which can be very good so you don’t run into unwanted bugs (the benefit of type checking) you can at the beginning of the script set the type to —!strict

If you are familiar with other programming languages, specifically JavaScript, then you might be familiar (or you might have heard of) with something called TypeScript. TypeScript is basically just JavaScript with Types.

Anyways, here are the main benefits of doing this:

  • Like you showed gives you autocomplete
  • Can get rid of future un-wanted bugs
  • Can keep your code organized, especially if you are someone who doesn’t like to name your variables something meaningful
  • Makes you look professional (lol)

Can find more info here too.