What is so bad about using Deprecated code?

Okay so I am making a raycasting script and I was going to use FindPartOnRayWithIgnoreList but it is outdated with WorldRoot:Raycast() along with RaycastParams. What is so bad if I use old code?

3 Likes

Deprecated means it’s no longer supported and is planned to be completely removed in the future by being replaced by new alternatives.

6 Likes

Deprecated code isn’t supported, so it may work now, but if it breaks, it will never be fixed, so you will have to use an alternative, supported method if that happens.

5 Likes

@steven4547466 Deprecated code is still usable, Roblox keeps them for legacy content.


The only reason deprecated code shouldn’t be used is because:

  1. It is unsupported
  2. Making a support topic with deprecated code is confusing
  3. It might not pack as much functionality
  4. It’s inconsistent
4 Likes

Don’t use deprecated code, it could break and won’t be fixed. New RaycastParams Property, Deprecating Old Raycast Functions

I never said it wasn’t usable. I said it’s no longer supported. I did say it’s planned to be removed, which is the case because if it breaks, they’ll remove it, not fix it.

3 Likes

You can use deprecated code. But you have a risk of it breaking when a new Roblox update comes out.

4 Likes

Say, for instance, the game may become poorly optimized afterwards (I’m not some kind of code genie, I just got the chance to join the Dev Forum) or simply the game will be unplayable afterwards. This is why most game developers update their games in-case deprecated code is still being used.

1 Like

Deprecation happens for a few different reasons. In this case, they made a new raycasting system that is better optimized and it required a new API. So the real question is, what is so bad about using the replacement for deprecated code? I can’t think of any reason to use the old API in this scenario. Raycasting | Roblox Creator Documentation

2 Likes

I was just wondering why I couldn’t use old code. But I am a bit confused on the new one tho.

There’s no reason you can’t use FindPartOnRayWithIgnoreList, but there’s also no good reason to use it.
If you’re confused how to use the new API, read how to use it on the dev hub. The page I linked has all the information you need.
It’s not a huge change:

local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = ignoreList
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)

is practically the same as

workspace:FindPartOnRayWithIgnoreList(Ray.new(rayOrigin, rayDirection), ignoreList)
1 Like

There’s a difference between deprecated and legacy. Deprecated implies that an item can be removed or break at any time with or without warning and you should switch to the updated method to avoid issues with your game, legacy means old and unsupported but no intentions of removal.

1 Like

While this is true, Roblox’s API does not differentiate between deprecated and legacy items. For example, classic Hints and Messages have been deprecated for years, but Roblox has no intention to remove them as older games heavily relied on them.

1 Like

The API docs are mostly automated through tags and there is no legacy tag. Hints and messages are deprecated and superseded by LayerCollectors (specifically ScreenGui). Their removal should still be expected because they’re deprecated, not legacy.

I wouldn’t speak for Roblox without credible substantiation because there’s no guarantee these will continue to exist in the API in the future. Roblox does the best they can to maintain backwards compatibility but they don’t always (or ever?) keep old items just because older games may break.

There are some circumstances where they do take aged games into consideration and others where keeping an old API may cause legitimate technical issues (e.g. LoadLibrary). In the latter case, even if old games break, it still needs to be removed to allow platform progress.

2 Likes

The main reason why you shouldn’t use outdated functions is that they aren’t supported by Roblox in favor of newer alternatives. Therefore, they are prone to issues. While many deprecated functions are still available in order to support older games, some will eventually be removed.

You can use deprecated code all you want, but it won’t be updated, won’t be fixed, and possibly even replaced. So with using deprecated code comes the task of watching your code each update to make sure it doesn’t break. Honestly not worth it in my opinion.

1 Like

I tweeted about this recently: Using deprecated code is like crossing a bridge you know is no longer being maintained. Maybe it will fall; maybe it won’t. But there’s no guarantee of it not falling, and that’s the problem.

Avoid using deprecated code.

8 Likes

Using Deprecated variables or coding won’t be supported by ROBLOX’s LUAU system anymore.

Moreover, the game won’t be able to function properly due to Deprecated codes being thrown out.

In depth:

Deprecated code is any code flagged for future removal , but which has not yet been removed to ensure that existing code which relies on the to-be-removed code will continue to work.

It’s recommended 100% to not use any deprecated coding in the years ahead of developing on the ROBLOX Platform.

1 Like