Hello.
This code is supposed to set the players character to the character in the viewport frame which kinda works, but the camera no longer follows the player after changing it and when you die the players character changes back to the default character. The new character also does not have a run animation. How do I fix these problems? Thanks for any help
Server Script
game.ReplicatedStorage.EquipPlayer.OnServerEvent:Connect(function(plr, characterName)
if game.ReplicatedStorage.Characters:FindFirstChild(characterName) then
local characterClone = game.ReplicatedStorage.Characters:FindFirstChild(characterName):Clone()
characterClone.HumanoidRootPart.CFrame = plr.Character.HumanoidRootPart.CFrame
characterClone.Parent = workspace
plr.Character = characterClone
game.Workspace.CurrentCamera.CameraSubject = characterClone.Humanoid -- This code doesn't even fix the camera problem but it doesn't error
end
end)