Hello, I have a platforming game which involves the W,A,D keys to move it left, right, or up. The movement works just fine, but I want to tween it to remove the jerkiness of the cframe. I want to only tween the x and y axis and not the z, but I keep getting the resulting errors such as; "attempt to index field 'cframe' (a nil value)" and "x cannot be assigned to". Here is the script I am using for the tweening:
local cfgoal = {}
cfgoal.CFrame = CFrame.new()
cfgoal.CFrame.X = newX
cfgoal.CFrame.Y = newY
local tweeninfo = TweenInfo.new(0.15)
local tween = tweenser:Create(workspace.Player, tweeninfo, cfgoal)
player.CFrame = CFrame.new(newX,newY,newZ)
camera.CFrame = CFrame.new(CameraX,CameraY,newZ + 19.25)
print("cur x - ".. cfgoal.CFrame.X)
print("cur y - ".. cfgoal.CFrame.Y)
The newX and newY variables are listed above the code. Is there anyway I could possibly tween the x and y axises, and leave the z axis alone?
Also, the line the error comes from is on line 3 of this script.

7 comments
What do you mean by calling it every frame?
I mean using some sort of loop that runs every frame (ex using RunService). Connect to RunService.Heartbeat with code that updates how much progress the tween should have made (based on time elapsed), then call GetValue for both the X and Y coordinates based on that value. When the tween is done, disconnect the connection to RunService.
I am actually using runservice to keep remaking the tween and updating it so it would work perfectly.
Is it fine that I am using renderstepped?
Also, when you say call GetValue for x and y, is the alpha where we put the x and y coord?
RenderStepped is fine; if used in a LocalScript it can slow things down if you put a lot of code in there (but it runs immediately after Roblox receives user input and immediately before Roblox starts to render a frame).
My thought with GetValue was that you don't create a Tween at all (since you didn't want to change the .Z position of the object), but every frame (ex every time RenderStepped fires) you figure out how far into the tween you are -- this is "alpha", which could equal: (tick() - tweenStartTime)/tweenTotalTime Call GetValue with that value for the X and then the Y coordinates