I am currently trying to make a camera tween towards the front of a player’s face (using myself as an example).
As the camera tweens towards the front of the player’s head (in which it is expected to), most of the time, it either tweens behind the player’s head or beside it. Some cases, it even clips inside of the player’s head, as shown in the video below:
Attempting the CFrame function, I used its :LookAt() to position the camera to the front of the player’s head, and to rotate it to that position. I applied this to the CurrentCamera’s tween.
The LocalScript I had put in the StarterPlayerScripts adds function to the game (as of now), including but not limited to the button’s events (aiming to make a singleplayer game here). Shown below is the LocalScript I had created for the button:
local clicked = false
local CurrentCamera = game.Workspace.CurrentCamera
local happyButton = game.Workspace.happybutton:WaitForChild("Button")
local floatingClickText = game.Workspace.floatingclicktext.buttonCLICKSIGN
local malleo = game.ReplicatedStorage.STORYOFMALLEO
local Character = game:GetService("Players").LocalPlayer.Character
local SFX = game.Workspace.SFX
happyButton.ClickDetector.MouseClick:Connect(function(playerWhoClicked)
if clicked == false then
happyButton.clicksound:Play()
game:GetService("TweenService"):Create(happyButton, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {CFrame = game.Workspace.happybutton.ButtonEndTween.CFrame}):Play()
floatingClickText.Float.Enabled = false
game:GetService("TweenService"):Create(floatingClickText, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {CFrame = floatingClickText.Parent.floatuptween.CFrame}):Play()
game:GetService("TweenService"):Create(game.Workspace.Music.opening, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {Volume = 0}):Play()
happyButton.ClickDetector.MaxActivationDistance = 0
clicked = true
wait(1)
floatingClickText.Transparency = 1
floatingClickText.Attachment.ParticleEmitter.Parent = game.ReplicatedStorage
print("Camera tweening...")
Character.Humanoid.WalkSpeed = 0
Character.Humanoid.JumpHeight = 0
CurrentCamera.CameraType = Enum.CameraType.Scriptable
game:GetService("TweenService"):Create(CurrentCamera, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {CFrame = game.Workspace.CutsceneCameraLocations.Camera1.CFrame}):Play()
print("Camera tweened.")
malleo.Parent = game.Workspace
game:GetService("TweenService"):Create(malleo, TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {CFrame = game.Workspace.hehasrisen.CFrame}):Play()
wait(3)
local cameraParttoFace = Instance.new("Part", game.Workspace)
local cameraParttoFacePosition = cameraParttoFace.CFrame.Position
local HeadCFrame = Character.Head.CFrame
cameraParttoFace.CFrame = CFrame.new(Vector3.new(HeadCFrame.LookVector.X * 2, HeadCFrame.Position.Y, HeadCFrame.Position.Z), Vector3.new(HeadCFrame.Position.X, HeadCFrame.Position.Y, HeadCFrame.Position.Z))
cameraParttoFace.Anchored = true
cameraParttoFace.Transparency = 1
cameraParttoFace.CanCollide = false
game:GetService("TweenService"):Create(CurrentCamera, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {CFrame = cameraParttoFace.CFrame}):Play()
local bruhFace = Instance.new("Part", game.Workspace)
bruhFace.Anchored = true
bruhFace.Transparency = 1
bruhFace.CFrame = CFrame.new(Vector3.new(HeadCFrame.LookVector.X + 2, HeadCFrame.Position.Y, HeadCFrame.Position.Z))
local bruhFaceDecal = Instance.new("Decal", bruhFace)
bruhFaceDecal.Face = Enum.NormalId.Back
bruhFaceDecal.Texture = "rbxassetid://6768332188"
bruhFaceDecal.Transparency = 1
wait(1)
SFX.bruh:Play()
bruhFaceDecal.Transparency = 0
wait(0.1)
game:GetService("TweenService"):Create(bruhFaceDecal, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {Transparency = 1}):Play()
end
end)