Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make a camera follow behind the player??

Can somebody please help? I have been working on it for a while and nothing works! Honestly anything is fine. But like This is the script i had before

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera

Camera.CameraType = Enum.CameraType.Scriptable

while true do
	Camera.CFrame = Player.Character:WaitForChild('Head').CFrame + Vector3.new(0,1,0)
wait()
end

ples help, im hopeless

1 answer

first thing is you already define character variable so you cant just write Player.Character at line 8

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera

Camera.CameraType = Enum.CameraType.Scriptable

while true do
    Camera.CFrame = Player.Character:WaitForChild('Head').CFrame + Vector3.new(0,1,0) --You can just type Character:WaitForChild
wait()
end

and it should be like this :

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera

camera.CameraType = Enum.CameraType.Scriptable

while wait() do
	camera.CFrame = Character:WaitForChild('Head').CFrame + Vector3.new(0,1,0)
end

let me know if it helps :)

2 comments

0

and also put this inside starter character script

0

or you can change camera type to attach instead scriptable

This discussion is preserved as it was. New answers, comments, and votes are closed.