So, we have type() which takes a lua data type and turns it into a string:
> print(type("hi")) string > print(type(1)) number > print(type(true)) boolean > print(type(nil)) nil > print(type(function() end)) function > print(type(game)) userdata > print(type(BrickColor.new()) userdata
but what about those userdatas? There are a few of them, like Object, Vector3, CFrame, BrickColor, UDim. It would be great to get a function that would tell us what type they are.
I have a tool to make roller coaster tracks, and it uses a BrickColorValue to tell the script what color it should use. Here’s the problem: there’s no really good way to tell when the BrickColorValue is being used and when it has a BrickColor written in instead. type() doesn’t discern between a BrickColor and Object, they’re both userdata to it. Using pcall() to determine is the only way, and that’s terrible.