Hi, I just came across something called a CFrameValue
when I was looking up for values. I want to know when, where and how to use it, because I think it might make it easier to solve problems in making games.
Hope someone can tell me!
CFrameValue
is an object, that contains a CFrame Value. And there are many objects like this guy that store many types values (values can also be refered to data types). For example a Vector3Value
exists, and that simply stores Vector3 values, a NumberValue
and IntValue
object exist too, used to store numbers (1, 2.5, -5.9..) or only integers (-1,0,1,2..). They are container objects.
And there is pretty much a Value object for each rbxlua datatype (value).
You might find a Value object for all of these.
These are all the Value objects that exist. Check out the wiki. !These
Now, talking about the CFrameValue, As I said used to store a CFrame Value, so you would expect the CFrameValue
object to have a property called CFrameValue.Value
which is set to whatever the object value is for. If you set it to something that is not a cframe it won't work and it'll go back to the default value.
Now since CFrame has 12 components, you'd expect the value to look like this.
!
There, that's how a cframe value looks like. Just hop on in studio and try all these value out.
Now let's set this value. (any value object has its name set to "Value" by default not the real full name, so a cframe object would have a name of "Value")
local object = workspace.Value -- this is the CFrame object object.Value = CFrame.new(1,2,3) --you see we set it too a cframe value. print(object.Value)
! There ya go, we set it to 1,2,3 without changing the rest, and that's how to work with it.
you might be like, what are these objects for, they are used to share some values between scripts. I don't think this CFrameValue is used that much, but i think the most used one is BoolenValue so yeah, if you click a part it will set the value property to true and then another script will check if that property is equal to true, pretty much.
! This is a number value, stores numbers.
! And a bool value, which has that checkbox thing, to set to true or false. So check these out.
in layman's terms a cframe or coordinate frame is just like the grid you worked in school with. x y and z.