Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm not sure what a CFrameValue does?

Asked by 5 years ago
Edited 5 years ago

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!

0
A CFrame controls the position AND orientation of objects in the 3d workspace. There's a lot of information about CFrames on this page: https://developer.roblox.com/api-reference/datatype/CFrame MegaManSam1 207 — 5y
0
CFrame Value, not CFrame HomieFirePGN 137 — 5y

2 answers

Log in to vote
0
Answered by
starmaq 1290 Moderation Voter
5 years ago

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.

0
And you must check CFrame out, it's na interesting topic starmaq 1290 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

in layman's terms a cframe or coordinate frame is just like the grid you worked in school with. x y and z.

0
it's not. cframes also store orientation data BenSBk 781 — 5y
0
same principles? extremeparkrider 0 — 5y
0
thx dude you explain this very well and simply mathis130130 0 — 3y

Answer this question