Tween service camera broken on my plane model

Ok so first of the system I currently have the tween service system and a gui. It works as it should,i click on the gui and it moves the camera.

now my problem is when I use it with the plane tool,the camera doesnt move with the plane and it stays in the original cframe of the part.


This is the script,how can I modify it i guess,so the camera moves with the plane.

local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutsceneTime = 1.5

local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

function tween(part1,part2)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame

	local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
	tween:Play()

	wait(cutsceneTime)
	
end


tween(game.Workspace.CurrentCamera,script.Parent.Value.Value.overhead)

1 Like

Iā€™m not sure if it has something to do with setting the camera type once but I also have the same problem until I used a loop.

local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutsceneTime = 1.5

local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

function tween(part1,part2)
	repeat wait() camera.CameraType = Enum.CameraType.Scriptable until camera.CameraType == Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame
	
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
	tween:Play()

	wait(cutsceneTime)

end


tween(game.Workspace.CurrentCamera,script.Parent.Value.Value.overhead)

no still doesnt work. The same problem is happening,the plane keeps moving while the camera stays in the same place

Use a while true do wait() that constantly updates the camera position. or RunService RenderStepped ā€¦( localscript)
that spams the Camera.CFrame to part1.Cframe also use TweenOverride

local tweenInfo = TweenInfo.new(
	2, -- Time
	Enum.EasingStyle.Linear, -- EasingStyle
	Enum.EasingDirection.Out, -- EasingDirection
	-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
	false, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime
)```

Where would i put the while true do wait() loop?

local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutsceneTime = 1.5

local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	-1,
	false,
	0
)

function tween(part1,part2)
	repeat wait() camera.CameraType = Enum.CameraType.Scriptable until camera.CameraType == Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame
	
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
	tween:Play()

	wait(cutsceneTime)

end

it keeps looping the whole animation

then make a while true do wait() Cam.CFrame = Part2.CFrame ???

no it keeps looping because the repeat is set to -1 and thats not what im trying to achieve

then remove the -1 to 0 , but make a while true do wait() ```
CFrame = part2.CFrame

(So the CFrame gets constantly set to part2 aka where u want the tween to go...
If u want to set the camera to that part just do 

CurrentCamera.CameraSubject = part2 (this will make it so u can rotate camera around whilst in that position )

hmm i tried the camera.subject but I want my camera to be static

local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutsceneTime = 1.5

local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	-1,
	false,
	0
)

function tween(part1,part2)
	repeat wait() camera.CameraType = Enum.CameraType.Scriptable until camera.CameraType == Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame
	
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
	tween:Play()

	wait(cutsceneTime)
while true do wait()
camera.CFrame = part2.CFrame
end

end

nope still doesnt work,like before it keeps staying in the same place as the plane moves

is part2 moving with the plane? , also can u show me where it does tween(part1,part2)

yea the camera positions are moving

local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutsceneTime = 1.5

local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	-1,
	false,
	0
)

function tween(part1,part2)
	repeat wait() camera.CameraType = Enum.CameraType.Scriptable until camera.CameraType == Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame
	
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
	tween:Play()

	wait(cutsceneTime)
return true
end
if tween(game.Workspace.CurrentCamera,script.Parent.Value.Value.overhead) then
while true do wait(1)
camera.CFrame = script.Parent.Value.Value.overhead.CFrame
end
end

the part1 is the current camera view and part2 are these parts in the cockpit

and also this doesnt work
if tween(game.Workspace.CurrentCamera,script.Parent.Value.Value.overhead) then
while true do wait(1)
camera.CFrame = script.Parent.Value.Value.overhead.CFrame
end
end

can u send errors printing pls??? | im not using any script editor so it wont LowerCaseUpperCase etc-

no errors it works in the way it does the camera movement it just doesnt move with the plane

weld the cam to the plane then??