Camera does set camera subject when set with a script

You can write your topic however you want, but you need to answer these questions:

  1. Trying to set the camera subject

  2. It’s not setting it

  3. I have looked for solutions on the Developer Hub

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local starterCharacter = ReplicatedStorage:WaitForChild("StarterCharacter")
local Camera = game.Workspace.CurrentCamera


local players = Players:GetPlayers()

for i, player in ipairs(players) do
	if i <= 2 then
		if player.Character then
			player.Character:Destroy()
			local newCharacter = starterCharacter:Clone()
			newCharacter.Name = player.Name
			newCharacter.Parent = workspace
			player.Character = newCharacter
			wait(2)
			Camera.CameraSubject = game.Workspace[player.Name]:FindFirstChildWhichIsA("Humanoid")
		end
	end
	end

Does anyone know why this is happening please help me, thanks.

You can only set the CameraSubject using localscript… and only the localscript’s client CameraSubject so… you’re probably gonna have to use some remote event stuff

Like this?

local rep = game:GetService("ReplicatedStorage")

rep.SetCam.OnClientEvent:Connect(function()
	workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid")
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.