Players.Infuriashon.PlayerScripts.CameraScript:11: Expected ')' (to close '(' at column 109), got '}'

I’m heavily confused on what’s wrong with this script.

local cam = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local HRP = char:WaitForChild("HumanoidRootPart")
local tweeninf = TweenInfo.new(.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0)
local tweenservice = game:GetService("TweenService")
cam.CameraType = Enum.CameraType.Attach
cam.CameraSubject = HRP

function camerafollow()
	local camfol = tweenservice:Create(cam, tweeninf, {CFrame = CFrame.new(HRP.Position) * CFrame.new(0, 30, 10) * CFrame.Angles(math.rad(-60), 0, 0)}
end)

I’d like to fix this bug, thanks!

It is exactly what it says, you need to close out the tweenservice:Create with a ) not a }.

3 Likes

I re-wrote your code, you must’ve accidentally ended a statement with a ‘}’ instead of a ‘)’.

local TweenService = game:GetService("TweenService")
local info = TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)

local player = game:GetService("Players")
local character = player.CharacterAdded:Wait()
local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Attach
camera.CameraSubject = HumanoidRootPart

local function cameraFollow()
    local cameraFollow = TweenService:Create(camera, info, {
        CFrame = HumanoidRootPart.CFrame * CFrame.new(0, 30, 10) * CFrame.Angles(math.rad(-60),0,0)
    })
    return cameraFollow
end
1 Like

Essentially what happened was that there was a “)” by the end so it would function properly. It works now.

This is the new code:

local cam = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local HRP = char:WaitForChild("HumanoidRootPart")
local tweeninf = TweenInfo.new(.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0)
local tweenservice = game:GetService("TweenService")
cam.CameraType = Enum.CameraType.Attach
cam.CameraSubject = HRP

function camerafollow()
	local camfol = tweenservice:Create(cam, tweeninf, {CFrame = CFrame.new(HRP.Position) * CFrame.new(0, 30, 10) * CFrame.Angles(math.rad(-60), 0, 0)})
	camfol:Play()
end

game:GetService("RunService").Stepped:Connect(function()
	camerafollow()
end)

Thanks!

Please mark this as the solution!