Storing orientation in a table

i can’t store an orientation in a table i ve tried this method
local t = {
Orientation = CFrame.Angels(0,18,0)
}
but i get this error
Orientation is not a valid member of cframe

Because in a table, the Orientation property is considered a index(Orientation). The easiest way is just not to make it a table but that would be unorganised.

but i don’t use that property like this i use it like
part.Orientation = t.Orientation

Huh, That’s weird, also you spelt angles wrong in the post, maybe instead of CFrame angles, you can use Just the CFrame, since it holds the position and orientation.

in roblox i use the autofiller so i m sure im not wrong on my script but here i think i am anyways
here is my code

local t = {}
t[plr.UserId].Orientation = CFrame.angles(0,15,1)
remotevent:FireClient(plr,t[plr.UserId].Orientation)
--then i send the table info to a local script for future use

--local script
local info ={}
remoteevent.OnClientEvent:Connect(function(plr,orientation)
info[plr.UserId] = orientation
end
--now for my model inside a part of a function
local piv = model:GetPivot()
model:Pivot(piv * model)

local T = {
	Orientation = CFrame.Angles(0,math.rad(90),0)
}

local Obj = game.Workspace.Rig.HumanoidRootPart

Obj.CFrame *= T.Orientation

or

local T = {
	Orientation = CFrame.Angles(0,math.rad(90),0)
}

local Obj = game.Workspace.Rig.HumanoidRootPart

Obj.CFrame = CFrame.new(Obj.Position) * T.Orientation

model:Pivot(piv * model)

piv:CFrame * model:? Model? Part?

Oh, you need to create blank table for new index because of

local Table = {}
Table["Player"].Smth = 1
print(Table)

This doesn’t work because when you add [Player] as a key for a table, it have nil as value, and you’re trying to get the key from a nil value
image

This should look like this

local Table = {}; 
if not Table["Player"] then
   Table["Player"] = {}
end
Table["Player"].Smth = 1
print(Table)

image

in your case

local t = {}
if not t[plr.UserId] then t[plr.UserId] = {} end
t[plr.UserId].Orientation = CFrame.angles(0,15,1)

i ve used this method aftee useing the normal one

sry i meant model not a part

if i print the table on local script i get the values of the cframe so i dont think thats the problem and i dont get the nil value

Also, you using Pivot instead of PivotTo

model:Pivot(piv * model)

im not sure, but i think it should look like this

--local script
local info ={}
remoteevent.OnClientEvent:Connect(function(plr,orientation)
info[plr.UserId] = orientation
end
--now for my model inside a part of a function
local piv = model:GetPivot()
model:PivotTo(piv * info[plr.UserId])

well i think ive used tbat since i havent recieved any error related to syntax error or unkown property am i alright can u please help me with it

Okay, but have you checked what line exactly triggers the error? The post lacks enough information in order for other people to even help you. According to what the error says, it means that you’re trying to index “Orientation” in a CFrame data type, and the piece of code you’re providing does not show any attempt of indexing.

1 Like

it shows error on the line whwre i try useing pivoto methos

Part.Orientation expects a Vector3 value, but the value stored in t.Orientation is a CFrame, which is why you’re getting that error

If 18 is in degrees, then to fix your issue you’ll need to do:

local t = {
Orientation = Vector3.new(0, 18, 0)
}

Otherwise, if it’s in radians, you’ll need to do:

local t = {
Orientation = Vector3.new(0, math.deg(18), 0)
}

This is because Part.Orientation expects a value in degrees, unlike CFrame.Angles which expects a value in radians

it didnt work eithet i ve tried this method yesterday

I don’t recommend using the assistant if you’re still learning how to script, here’s one of the reasons why:

It’s trying to multiply a CFrame value with a Model Instance, which will cause your code to error

I think it would be best to rewrite the code, since the assistant did a pretty horrible job on it, but we’ll need more information on what you’re trying to do in-order to be able to help you


@xxmanado

I thought you were calling the assistant “autofiller”, so I wrote autofiller as well, but I was talking about the AI assistant

Like @GoulStorm and I previously said, we’ll need to see your code in-order to be able to help you, showing us the table or the error by itself isn’t enough information because we don’t know how the table is being used, or where the error originated from

firstt the autofiller i use is only for words that are either long or hard to remember (at least fpr me) like filterdesecendanttype or fromeulerangel sometimes i write angles instead of angels and second i ve tried to store the orientation ueing vector3 and thenn use it like this
model.Orientation = t[Orientation] and model.Rotation =t.[Orientation] ( ik that ive used oeientarion 2 times but it doesnt matter since it is just a name) and then the third try was useing thia pivoto methos which i ve seen it before and i think that i ve mentiones it here in one of my replies

information like what? rell me and i ll givw u