I don't get code complete options when subtracting vectors

image

I don’t remember if it’s .Magnitude or .magnitude or .mag or :magitude() and the interface doesn’t help me so I have to go look it up.

Seems like this expression should get code complete since the types are strong. I’m 99% sure Adornee has to always have a Position.

Nevermind. This doesn’t work because Adornee is an Instance (How does BillboardGUI work if the Adornee has no 3D position? It should be an IPositionable or something)

But this doesn’t work:

image

This works:

image

This doesn’t:

image

I think the last example should work.

5 Likes

The problem is the script editor isn’t very advanced at inferring types from expressions because of how flexible the Lua language is. As far as it knows, most expressions could result in anything, so it usually doesn’t offer an autocomplete at all.

The autocomplete system seems to have a limit on how far it is willing to process certain expressions before it utterly gives up. This is two variables deep for direct instance paths, and one or none for almost everything else:

local ServerStorage = game.ServerStorage
local Part = ServerStorage.Part
local Position = Part. -- And autocomplete gave up.

However, the engineers are working on type safety language features, so some of the problem may be alleviated in the future.

Until then, as a workaround, you can press dot on an instance path by itself to find out what properties are available. For example, you could press dot after the game.Workspace.CurrentCamera.CFrame.Position part of the expression to get a list of properties usually associated with Vector3s.