Should I use position, CFrame, Vector3, or what? I have a camera script in game.StarterPlayer.StarterPlayerScripts.CameraScript. It changes the camera to be at a part, the part is in Workspace. The part is called CameraPart. I want to move the Camera aka CameraPart. The camera script works. But, the move CameraPart script does not work. Please help.
Here is my camera script:
wait(2.01) local CurrentCamera = workspace.CurrentCamera local Part = workspace.CameraPart CurrentCamera.CameraType = Enum.CameraType.Scriptable CurrentCamera.CFrame = Part.CFrame wait(.25) local CurrentCamera = workspace.CurrentCamera local Part = workspace.CameraPart CurrentCamera.CameraType = Enum.CameraType.Scriptable CurrentCamera.CFrame = Part.CFrame
Here is my move CameraPart script:
wait(10) script.Parent.Position = -29.5, 14.5, 103.5
Remember that in multiple assignment, additional results get silently discarded.
local a, b, c = 1 -- b and c get nil
local a = 1, 2 -- 2 is discarded, a gets 1
You use the Vector3.new
constructor function to create a new instance of a Vector3
:
script.Parent.Position = Vector3.new(-29.5, 14.5, 103.5)
I know this may sound rude but... Isn't this the first beginner's lessons of scripting?
script.Parent.Position = Vector3.new(-29.5, 14.5, 103.5) --This would move the part to the current coordinates.
Not sure if you meant moving like with an animation as tween service...
P.S remove the comments (the ones that start with 2 divides (--) or don't.. it doesn't really matter...