How do I move an anchored part?

So I made a script that changes the position of an anchored part using CFrame, but it doesn’t seem to be working. The line in question is below. Can somebody explain why this doesn’t seem to be moving?

This is using TweenService

goal.CFrame = CFrame.new(game.Workspace.CameraPart.Position + Vector3.new(0,0,.5))

This is the full script:

local TweenService = game:GetService("TweenService")

local player = game.Players.LocalPlayer
local weaponsUI = player:WaitForChild("PlayerGui"):WaitForChild("Weapons")

weaponsUI.Weapon.MouseButton1Click:Connect(function()
	local goal = {}
	goal.CFrame = CFrame.new(game.Workspace.CameraPart.Position + Vector3.new(0,0,2.5))
	print(goal.CFrame)
	local tweenInfo = TweenInfo.new(1.5)
	local Tween = TweenService:Create(game.Workspace.CameraPart,tweenInfo,goal)
	Tween:Play()
end)
1 Like

Is the “weaponsUI.Weapon” some sort of button?

yeah if it was my game I would name it differently. The printing is working btw

I setted up a almost exact recreation of what you are doing here.
Used the same script you made.

It’s working fine…

Here is the image

https://i.gyazo.com/246181b2e11b1f40e848dc564cd6d922.png

Did you make the part anchored?
Also, the cameraPart is where the current position of the player’s camera is when this is run

Yes the part is anchored, You also didn’t positioned the part to be the camera position in the full script you linked there…

Yeah that’s because that’s a script I didn’t write. I can rewrite it as an edit really quick:
(localScript)

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CFrame = game.Workspace.CameraPart.CFrame

Does that part of the script runs in a loop? Since the camera part position is always changing due to the tweening.

That’s a good point I should have thought of that. I’ll have to find the camera script and make it work like that.

Did it work? If so u can mark my answer as solution.

I also do not know why you are changing the camera cframe by a part, there are other methods like the property of the humanoid named CameraOffset