Trying to work with CFrame tables, keep getting an annoying "Expected identifier when parsing expression, got '[' " error for seemingly no reason

Heya Everyone!!

I’m experimenting with CFrame tables in order to use them for animation. I’m using this plugin in order to convert animations into module scripts to do so. The issue is that ROBLOX Studio is acting stupid for whatever reason and keeps thinking that this is an error?

Notice how the [0.333] = { is highlighted in red while [0.167 = { is not. Here’s the entire CFrame table if anyone wants it. This is seriously starting to annoy me.

return {
	Properties = {
		Looping = true,
		Priority = Enum.AnimationPriority.Action
	},
	Keyframes = {
		[0] = {
			["HumanoidRootPart"] = {
				},
				["Torso"] = {
					CFrame = CFrame.new(-0, -3.3527612686157227e-07, 0.2041921615600586, 1, -0, 0, 0, 0.9874922633171082, -0.15766751766204834, 0, 0.15766751766204834, 0.9874922633171082),
					["Head"] = {
						CFrame = CFrame.new(0, 0, 0, 1, -0, 0, 0, 0.9851605296134949, 0.17163538932800293, 0, -0.17163538932800293, 0.9851605296134949),
					},
					["Left Leg"] = {
						CFrame = CFrame.new(0, 0, 0, 0.7632114887237549, -0.6461488008499146, 0, 0.6461488008499146, 0.7632114887237549, 0, 0, 0, 1),
					},
					["Right Arm"] = {
						CFrame = CFrame.new(-1.4901161193847656e-08, 0, 0, 0.8950780034065247, 0.4459095895290375, 0, -0.4459095895290375, 0.8950780034065247, 0, 0, 0, 1),
					},
					["Right Leg"] = {
						CFrame = CFrame.new(0.35112568736076355, 0.16322368383407593, 0, 0.9068105220794678, -0.42153844237327576, 0, 0.42153844237327576, 0.9068105220794678, -0, 0, 0, 1),
					},
					["Left Arm"] = {
						CFrame = CFrame.new(0, 0, 0, 0.8868620991706848, 0.4620342254638672, 0, -0.4620342254638672, 0.8868620991706848, 0, 0, 0, 1),
					},
				},
			},
		},
		[0.167] = {
			["HumanoidRootPart"] = {
				},
				["Torso"] = {
					CFrame = CFrame.new(-0, -3.725290298461914e-07, -0.2972480058670044, 1, -0, 0, 0, 0.971375048160553, -0.23755112290382385, 0, 0.23755112290382385, 0.971375048160553),
					["Head"] = {
						CFrame = CFrame.new(0, 0, 0, 1, -0, 0, 0, 0.9736671447753906, 0.22797462344169617, 0, -0.22797462344169617, 0.9736671447753906),
					},
					["Left Leg"] = {
						CFrame = CFrame.new(-0.9664036631584167, 0.560836672782898, 0, 0.5112440586090088, -0.8594356179237366, 0, 0.8594356179237366, 0.5112440586090088, 0, 0, 0, 1),
					},
					["Right Arm"] = {
						CFrame = CFrame.new(0.029241546988487244, -0.1681918501853943, 0, 0.9852209091186523, -0.17128881812095642, 0, 0.17128881812095642, 0.9852209091186523, -0, 0, 0, 1),
					},
					["Right Leg"] = {
						CFrame = CFrame.new(0.5295323133468628, 0.4789509177207947, 0, 0.9704298973083496, -0.24138304591178894, 0, 0.24138304591178894, 0.9704298973083496, -0, 0, 0, 1),
					},
					["Left Arm"] = {
						CFrame = CFrame.new(-0.029241546988487244, -0.1681918501853943, 0, 0.9852209091186523, 0.17128881812095642, 0, -0.17128881812095642, 0.9852209091186523, 0, 0, 0, 1),
					},
				},
			},
		},
		[0.333] = {
			["HumanoidRootPart"] = {
				},
				["Torso"] = {
					CFrame = CFrame.new(0, -3.3527612686157227e-07, 0.2041921615600586, 1, 0, 0, 0, 0.9874922633171082, -0.15766751766204834, 0, 0.15766751766204834, 0.9874922633171082),
					["Head"] = {
						CFrame = CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.9851605296134949, 0.17163538932800293, 0, -0.17163538932800293, 0.9851605296134949),
					},
					["Left Leg"] = {
						CFrame = CFrame.new(-0.35112568736076355, 0.16322368383407593, 0, 0.9068105220794678, 0.42153844237327576, 0, -0.42153844237327576, 0.9068105220794678, 0, 0, 0, 1),
					},
					["Right Arm"] = {
						CFrame = CFrame.new(0, 0, 0, 0.8868620991706848, -0.4620342254638672, 0, 0.4620342254638672, 0.8868620991706848, 0, 0, 0, 1),
					},
					["Right Leg"] = {
						CFrame = CFrame.new(0, 0, 0, 0.7632114887237549, 0.6461488008499146, 0, -0.6461488008499146, 0.7632114887237549, 0, 0, 0, 1),
					},
					["Left Arm"] = {
						CFrame = CFrame.new(1.4901161193847656e-08, 0, 0, 0.8950780034065247, -0.4459095895290375, 0, 0.4459095895290375, 0.8950780034065247, 0, 0, 0, 1),
					},
				},
			},
		},
		[0.5] = {
			["HumanoidRootPart"] = {
				},
				["Torso"] = {
					CFrame = CFrame.new(0, -3.725290298461914e-07, -0.2972480058670044, 1, 0, 0, 0, 0.971375048160553, -0.23755112290382385, 0, 0.23755112290382385, 0.971375048160553),
					["Head"] = {
						CFrame = CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.9736671447753906, 0.22797462344169617, 0, -0.22797462344169617, 0.9736671447753906),
					},
					["Left Leg"] = {
						CFrame = CFrame.new(-0.5295323133468628, 0.4789509177207947, 0, 0.9704298973083496, 0.24138304591178894, 0, -0.24138304591178894, 0.9704298973083496, 0, 0, 0, 1),
					},
					["Right Arm"] = {
						CFrame = CFrame.new(0.029241546988487244, -0.1681918501853943, 0, 0.9852209091186523, -0.17128881812095642, 0, 0.17128881812095642, 0.9852209091186523, 0, 0, 0, 1),
					},
					["Right Leg"] = {
						CFrame = CFrame.new(0.9664036631584167, 0.560836672782898, 0, 0.5112440586090088, 0.8594356179237366, 0, -0.8594356179237366, 0.5112440586090088, 0, 0, 0, 1),
					},
					["Left Arm"] = {
						CFrame = CFrame.new(-0.029241546988487244, -0.1681918501853943, 0, 0.9852209091186523, 0.17128881812095642, 0, -0.17128881812095642, 0.9852209091186523, 0, 0, 0, 1),
					},
				},
			},
		},
		[0.667] = {
			["HumanoidRootPart"] = {
				},
				["Torso"] = {
					CFrame = CFrame.new(-0, -3.3527612686157227e-07, 0.2041921615600586, 1, -0, 0, 0, 0.9874922633171082, -0.15766751766204834, 0, 0.15766751766204834, 0.9874922633171082),
					["Head"] = {
						CFrame = CFrame.new(0, 0, 0, 1, -0, 0, 0, 0.9851605296134949, 0.17163538932800293, 0, -0.17163538932800293, 0.9851605296134949),
					},
					["Left Leg"] = {
						CFrame = CFrame.new(0, 0, 0, 0.7632114887237549, -0.6461488008499146, 0, 0.6461488008499146, 0.7632114887237549, 0, 0, 0, 1),
					},
					["Right Arm"] = {
						CFrame = CFrame.new(-1.4901161193847656e-08, 0, 0, 0.8950780034065247, 0.4459095895290375, 0, -0.4459095895290375, 0.8950780034065247, 0, 0, 0, 1),
					},
					["Right Leg"] = {
						CFrame = CFrame.new(0.35112568736076355, 0.16322368383407593, 0, 0.9068105220794678, -0.42153844237327576, 0, 0.42153844237327576, 0.9068105220794678, -0, 0, 0, 1),
					},
					["Left Arm"] = {
						CFrame = CFrame.new(0, 0, 0, 0.8868620991706848, 0.4620342254638672, 0, -0.4620342254638672, 0.8868620991706848, 0, 0, 0, 1),
					},
				},
			},
		},
	}
}

It moved the other keyframes outside of the Keyframes table, and it also had one too many brackets:

return {
	Properties = {
		Looping = true,
		Priority = Enum.AnimationPriority.Action
	},
	Keyframes = {
		[0] = {
			["HumanoidRootPart"] = {
			},
			["Torso"] = {
				CFrame = CFrame.new(-0, -3.3527612686157227e-07, 0.2041921615600586, 1, -0, 0, 0, 0.9874922633171082, -0.15766751766204834, 0, 0.15766751766204834, 0.9874922633171082),
				["Head"] = {
					CFrame = CFrame.new(0, 0, 0, 1, -0, 0, 0, 0.9851605296134949, 0.17163538932800293, 0, -0.17163538932800293, 0.9851605296134949),
				},
				["Left Leg"] = {
					CFrame = CFrame.new(0, 0, 0, 0.7632114887237549, -0.6461488008499146, 0, 0.6461488008499146, 0.7632114887237549, 0, 0, 0, 1),
				},
				["Right Arm"] = {
					CFrame = CFrame.new(-1.4901161193847656e-08, 0, 0, 0.8950780034065247, 0.4459095895290375, 0, -0.4459095895290375, 0.8950780034065247, 0, 0, 0, 1),
				},
				["Right Leg"] = {
					CFrame = CFrame.new(0.35112568736076355, 0.16322368383407593, 0, 0.9068105220794678, -0.42153844237327576, 0, 0.42153844237327576, 0.9068105220794678, -0, 0, 0, 1),
				},
				["Left Arm"] = {
					CFrame = CFrame.new(0, 0, 0, 0.8868620991706848, 0.4620342254638672, 0, -0.4620342254638672, 0.8868620991706848, 0, 0, 0, 1),
				},
			},
		},
		
		[0.167] = {
			["HumanoidRootPart"] = {
			},
			["Torso"] = {
				CFrame = CFrame.new(-0, -3.725290298461914e-07, -0.2972480058670044, 1, -0, 0, 0, 0.971375048160553, -0.23755112290382385, 0, 0.23755112290382385, 0.971375048160553),
				["Head"] = {
					CFrame = CFrame.new(0, 0, 0, 1, -0, 0, 0, 0.9736671447753906, 0.22797462344169617, 0, -0.22797462344169617, 0.9736671447753906),
				},
				["Left Leg"] = {
					CFrame = CFrame.new(-0.9664036631584167, 0.560836672782898, 0, 0.5112440586090088, -0.8594356179237366, 0, 0.8594356179237366, 0.5112440586090088, 0, 0, 0, 1),
				},
				["Right Arm"] = {
					CFrame = CFrame.new(0.029241546988487244, -0.1681918501853943, 0, 0.9852209091186523, -0.17128881812095642, 0, 0.17128881812095642, 0.9852209091186523, -0, 0, 0, 1),
				},
				["Right Leg"] = {
					CFrame = CFrame.new(0.5295323133468628, 0.4789509177207947, 0, 0.9704298973083496, -0.24138304591178894, 0, 0.24138304591178894, 0.9704298973083496, -0, 0, 0, 1),
				},
				["Left Arm"] = {
					CFrame = CFrame.new(-0.029241546988487244, -0.1681918501853943, 0, 0.9852209091186523, 0.17128881812095642, 0, -0.17128881812095642, 0.9852209091186523, 0, 0, 0, 1),
				},
			},
		},
		[0.333] = {
			["HumanoidRootPart"] = {
			},
			["Torso"] = {
				CFrame = CFrame.new(0, -3.3527612686157227e-07, 0.2041921615600586, 1, 0, 0, 0, 0.9874922633171082, -0.15766751766204834, 0, 0.15766751766204834, 0.9874922633171082),
				["Head"] = {
					CFrame = CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.9851605296134949, 0.17163538932800293, 0, -0.17163538932800293, 0.9851605296134949),
				},
				["Left Leg"] = {
					CFrame = CFrame.new(-0.35112568736076355, 0.16322368383407593, 0, 0.9068105220794678, 0.42153844237327576, 0, -0.42153844237327576, 0.9068105220794678, 0, 0, 0, 1),
				},
				["Right Arm"] = {
					CFrame = CFrame.new(0, 0, 0, 0.8868620991706848, -0.4620342254638672, 0, 0.4620342254638672, 0.8868620991706848, 0, 0, 0, 1),
				},
				["Right Leg"] = {
					CFrame = CFrame.new(0, 0, 0, 0.7632114887237549, 0.6461488008499146, 0, -0.6461488008499146, 0.7632114887237549, 0, 0, 0, 1),
				},
				["Left Arm"] = {
					CFrame = CFrame.new(1.4901161193847656e-08, 0, 0, 0.8950780034065247, -0.4459095895290375, 0, 0.4459095895290375, 0.8950780034065247, 0, 0, 0, 1),
				},
			},
		},
		[0.5] = {
			["HumanoidRootPart"] = {
			},
			["Torso"] = {
				CFrame = CFrame.new(0, -3.725290298461914e-07, -0.2972480058670044, 1, 0, 0, 0, 0.971375048160553, -0.23755112290382385, 0, 0.23755112290382385, 0.971375048160553),
				["Head"] = {
					CFrame = CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.9736671447753906, 0.22797462344169617, 0, -0.22797462344169617, 0.9736671447753906),
				},
				["Left Leg"] = {
					CFrame = CFrame.new(-0.5295323133468628, 0.4789509177207947, 0, 0.9704298973083496, 0.24138304591178894, 0, -0.24138304591178894, 0.9704298973083496, 0, 0, 0, 1),
				},
				["Right Arm"] = {
					CFrame = CFrame.new(0.029241546988487244, -0.1681918501853943, 0, 0.9852209091186523, -0.17128881812095642, 0, 0.17128881812095642, 0.9852209091186523, 0, 0, 0, 1),
				},
				["Right Leg"] = {
					CFrame = CFrame.new(0.9664036631584167, 0.560836672782898, 0, 0.5112440586090088, 0.8594356179237366, 0, -0.8594356179237366, 0.5112440586090088, 0, 0, 0, 1),
				},
				["Left Arm"] = {
					CFrame = CFrame.new(-0.029241546988487244, -0.1681918501853943, 0, 0.9852209091186523, 0.17128881812095642, 0, -0.17128881812095642, 0.9852209091186523, 0, 0, 0, 1),
				},
			},
		},
		[0.667] = {
			["HumanoidRootPart"] = {
			},
			["Torso"] = {
				CFrame = CFrame.new(-0, -3.3527612686157227e-07, 0.2041921615600586, 1, -0, 0, 0, 0.9874922633171082, -0.15766751766204834, 0, 0.15766751766204834, 0.9874922633171082),
				["Head"] = {
					CFrame = CFrame.new(0, 0, 0, 1, -0, 0, 0, 0.9851605296134949, 0.17163538932800293, 0, -0.17163538932800293, 0.9851605296134949),
				},
				["Left Leg"] = {
					CFrame = CFrame.new(0, 0, 0, 0.7632114887237549, -0.6461488008499146, 0, 0.6461488008499146, 0.7632114887237549, 0, 0, 0, 1),
				},
				["Right Arm"] = {
					CFrame = CFrame.new(-1.4901161193847656e-08, 0, 0, 0.8950780034065247, 0.4459095895290375, 0, -0.4459095895290375, 0.8950780034065247, 0, 0, 0, 1),
				},
				["Right Leg"] = {
					CFrame = CFrame.new(0.35112568736076355, 0.16322368383407593, 0, 0.9068105220794678, -0.42153844237327576, 0, 0.42153844237327576, 0.9068105220794678, -0, 0, 0, 1),
				},
				["Left Arm"] = {
					CFrame = CFrame.new(0, 0, 0, 0.8868620991706848, 0.4620342254638672, 0, -0.4620342254638672, 0.8868620991706848, 0, 0, 0, 1),
				},
			},
		},
	},
}
2 Likes

Looks like Mr Schnitzler provided the fixed solution above, but specifically you have extra closing braces on lines 29, 52, 75, 98, and 122. Remove the braces on these lines and you’ll be good to go (after fixing formatting, which you can do with right click > Format > Format Document)

Generally, you can find the issue by figuring out where the formatting starts to go wrong, such as in this case where [0.167] = { is no longer vertically in line with [0] = {, despite that they’re supposed to be in the same table. It’s cause by an extra closing brace on the line above it (and subsequently many more extra closing braces as listed)

1 Like

Thanks for providing the fixed code for me alongside what’s happening. I’ll also mark @BusyCityGuy solution marked as well since it goes more in-depth on what is happening.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.