I am making a game that required a computer to be used. I have all of the basic scripting done however the transition from the player’s camera to the computer’s camera is a little off. I used TweenService for this, which works but the only problem is that the Tween spins all the way around, but only on the right side. Here’s a video for you:
As you can see, the tween turns all the way around for some reason. Is there any way I can fix that?
Incase you need it, here is the Client Sided Code:
local tweenservice = game:GetService("TweenService")
local obj = nil
local camera = workspace.CurrentCamera
local tweeninfo = TweenInfo.new(2, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
local goalpos = workspace.Cameras.Passive:WaitForChild("Computer").Position
local goalrot = workspace.Cameras.Passive:WaitForChild("Computer").Orientation
local tween = tweenservice:Create(workspace.Cameras.Campart, tweeninfo, {Position = goalpos;Orientation = goalrot})
script.Parent:WaitForChild("BackButton").Visible = false
script.Parent:WaitForChild("BBBG").Visible = false
workspace.Cameras.Campart.Transparency = 1
workspace.Cameras.Passive.Computer.Transparency = 1
function updatecamin()
repeat wait()
camera.CFrame = workspace.Cameras.Campart.CFrame
until tween.PlaybackState == Enum.PlaybackState.Completed
if script.Parent.BackButton.Visible == false then
script.Parent.BackButton.Visible = true
script.Parent.BBBG.Visible = true
end
end
game:GetService("ReplicatedStorage").OpenComputerEvent.OnClientEvent:Connect(function(promptobject)
obj = promptobject
promptobject.Enabled = false
repeat camera.CameraType = Enum.CameraType.Scriptable until camera.CameraType == Enum.CameraType.Scriptable or "Scriptable"
workspace.Cameras.Campart.CFrame = camera.CFrame
tween:Play()
updatecamin()
end)
script.Parent.BackButton.MouseButton1Click:Connect(function()
repeat camera.CameraType = Enum.CameraType.Custom until camera.CameraType == Enum.CameraType.Custom or "Custom"
script.Parent.BackButton.Visible = false
script.Parent.BBBG.Visible = false
obj.Enabled = true
end)
Thank you!