The camera is stuck and is not being centered on the new character. I’m using server script
local zombie = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
local character = game.Workspace.Zombie
character.Name = zombie.Name
zombie.Character = character
while wait() do
if game.Players.LocalPlayer:GetAttribute("Zombie") == true then
local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
end
end
If you have a Team system then you can get what team the player is on, otherwise looking from your code, you can check if the character is a zombie by checking if the player’s name is, well, “Zombie”
You should probably use :GetAttributeChangedSignal() instead of a while loop.
local players = game:GetService("Players")
local player = players.LocalPlayer
local camera = workspace.CurrentCamera
local function zombieAttributeChanged()
local char = player.Character
if char then
local hum = char:WaitForChild("Humanoid")
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = hum
end
end
player:GetAttributeChangedSignal("Zombie"):Connect(zombieAttributeChanged)