So i have a script that Makes The Camera Rotate And when You press a button it Tweens the camera to
the CFrame of HumanoidRootPart
But i want The tween to Tween the camera to Enum.CameraType.Custom Cframe and i tried
workspace.Camera.CameraType = Enum.CameraType.Custom
local CameraCustomCFrame = workspace.Camera.CFrame
workspace.Camera.CameraType = Enum.CameraType.Scriptable
hi @Chill_andTrill709 , I fixed the problem, can you try this and let me know if it works for you
local TweenService = game:GetService("TweenService")
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local targetCFrame = humanoidRootPart.CFrame
local tweenInfo = TweenInfo.new(
1,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out,
0,
false,
0
)
local tween = TweenService:Create(camera, tweenInfo, {CFrame = targetCFrame})
tween:Play()
workspace.Camera.CameraType = Enum.CameraType.Scriptable
local TweenService = game:GetService("TweenService")
local rot = 0
local Menu = true
local CamPart =workspace:WaitForChild("CamPart")
script.Parent.Buttons.Play.Activated:Connect(function()
workspace.Camera.CameraType = Enum.CameraType.Custom
wait(0)
local CF = workspace.Camera.CFrame
workspace.Camera.CameraType = Enum.CameraType.Scriptable
workspace.Camera.CFrame = CamPart.CFrame
Menu = false
local Tweeninfo = TweenInfo.new(2,Enum.EasingStyle.Linear, Enum.EasingDirection.In,0,false)
local Char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local part = Char:WaitForChild("HumanoidRootPart")
local Tween = TweenService:Create(workspace.Camera,Tweeninfo, {CFrame = CF})
Tween:Play()
wait(2)
workspace.Camera.CameraType = Enum.CameraType.Custom
end)
repeat
wait(0)
rot+=0.5
CamPart.Orientation = Vector3.new(-20,rot,0)
workspace.Camera.CFrame = CamPart.CFrame
until Menu == false
robloxapp-20240330-1145080.wmv (1020.6 KB)
that is the vide you can hardly tell on it but it just flicers (because i set the camera type to custum and the back)and it works
To summarize i need to get the positon where the camera will be in camera type custom but when i get the cframe it flickers because
i set it to custom, get the cframe ,then set camera typa back to scriptable
this is good and i works but i want instead of tweening it to humanoid root part CFrame i want it to be the Cframe Camera will be in Enum.CameraType.Custom
i probbalby figgured it out i made a new camera made it rotate then when play is pressed i tween the new camera to the old one and the nset current camera back to the old one