I created a script that would change the player’s rig mid-game, but it completely broke the camera, and the player never respawns after resetting, and I can’t figure out how to fix these. Here is my script:
function PlayerAdded(player)
local Rig = game.Workspace.Rig:Clone()
local id = player.UserId
local playername = player.Name
local character = game.Workspace:WaitForChild(playername)
print(id)
print(Rig.Humanoid.Name)
Rig.Parent = game.Workspace
Rig:WaitForChild("Humanoid"):ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(id))
Rig.HumanoidRootPart.Position = character.HumanoidRootPart.Position
Rig.Humanoid.DisplayName = playername
player.Character = Rig
local Camera = game.Workspace.Camera
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = Rig.Head
Camera.CFrame = Rig.Head.CFrame
print("i work")
end
game.Players.PlayerAdded:Connect(PlayerAdded)
When you set CameraType to Scriptable, it disables all the core camera scripts, therefore you will need to do all the camera movement manually. If you want to keep the normal camera functionality then don’t change the CameraType.
Oh wait, sorry I wasn’t trying to keep the player in first person, the issue was that the player’s camera wouldn’t follow the player after switching rigs, and that whenever they reset, they wouldn’t respawn