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

why doesnt the camera focus on the position given?

local replicated = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local ReplicatedFirst = game:GetService("ReplicatedFirst")

local ImpParts = workspace:WaitForChild("ImportantParts")

local ClientEvents = replicated:WaitForChild("ClientEvents")
local Gui = replicated:WaitForChild("Gui")
local ServerEvents = replicated:WaitForChild("ServerEvents")
local Values = replicated:WaitForChild("Values")

wait()

local Cam = workspace.CurrentCamera
Cam.CameraType = Enum.CameraType.Scriptable


local D1 = ImpParts:WaitForChild("CameraD1")
local D2 = ImpParts:WaitForChild("CameraD2")
local D3 = ImpParts:WaitForChild("CameraD3")
local D4 = ImpParts:WaitForChild("CameraD4")
local Spawn = ImpParts:WaitForChild("Spawn1")

Cam.CoordinateFrame = CFrame.new(D1.Position) 
Cam.Focus = CFrame.new(Spawn.Position)

this wont return any errors and its in a local script(fe is on)

1 answer

I think you didn't set the camera's focus correctly, and there may be another errors.

Try this:

local replicated = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local ReplicatedFirst = game:GetService("ReplicatedFirst")

local ImpParts = workspace:WaitForChild("ImportantParts")

local ClientEvents = replicated:WaitForChild("ClientEvents")
local Gui = replicated:WaitForChild("Gui")
local ServerEvents = replicated:WaitForChild("ServerEvents")
local Values = replicated:WaitForChild("Values")

--Add camera variable here
local camera = workspace.CurrentCamera
local camera.CameraType = Enum.CameraType.Scriptable


wait()

local D1 = ImpParts:WaitForChild("CameraD1")
local D2 = ImpParts:WaitForChild("CameraD2")
local D3 = ImpParts:WaitForChild("CameraD3")
local D4 = ImpParts:WaitForChild("CameraD4")
local Spawn = ImpParts:WaitForChild("Spawn1")

camera.Focus = CFrame.new(Spawn.Position)
--if this won't work, make the last line be: "camera.Focus = Spawn"

If this works, mark as the solution, and as always, good scripting! ;D

4 comments

0

didnt work

0

strange... did you try the other option, that I gave below? btw, are you sure the paths are ok?

0

yea btw check line 15;) and what do you mean with the path being ok?

0

like path to an object. for example instead of putting game.Workspace.Tool putting game.Workspace.Part.Tool (when the path to an object is wrong)

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