#Camera set not working

28 messages · Page 1 of 1 (latest)

subtle solar
#

I created a script that sets the players camera to a part on spawn. It's very simple, I dont know why its not working. the script is a localscript in starter player scripts, and there is nothing in output. Please help

#

Heres the script:

local part = game.Workspace.MenuCamera
local players = game:GetService("Players")

local function setCamera(player)
    local camera = game.Workspace.CurrentCamera
    camera.CameraType = Enum.CameraType.Scriptable
    camera.CameraSubject = part
end

players.PlayerAdded:Connect(setCamera)
fading ferry
#
local plr = game.Players.LocalPlayer
local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = part
subtle solar
#

what about the playeradded thing

fading ferry
#

The issue here is that when you already joined, the players.PlayerAdded:Connect(setCamera) won't start for you, instead for another player and I dont think you can move the camera for another player like that... actually... maybe

frigid pumice
subtle solar
#

ok

frigid pumice
#

try setting the Cframe and tell me if it doesnt work

subtle solar
#

it didnt

frigid pumice
subtle solar
#

14:30:21.600 Argument 1 missing or nil - Server - Script:6

#

the new script

#
local part = game.Workspace.MenuCamera
local players = game:GetService("Players")
local camera = game.Workspace.CurrentCamera

players.PlayerAdded:Connect(function()
    camera.CameraType = Enum.CameraType.Custom
    camera.CameraSubject = part
end)
cosmic stratusBOT
#

studio** You are now Level 5! **studio

frigid pumice
#

or was it the previouse script

#

where you added cframe

subtle solar
#

let me test the new one

frigid pumice
#

wait

#

this is the server script

subtle solar
#

no i deleted that

#

and the event

frigid pumice
#

you have the Code inside a local script or server script?

subtle solar
#

localscript

#

starterplayerscripps

frigid pumice
#

alr i just tested for you in my studio and i found and simpeler way. you can just say:

local part = game.Workspace.MenuCamera
local camera = game.Workspace.CurrentCamera

camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = part

#

it should work