I’ve got these custom character models so that every time you respawn the game will pick a random model and make it your player model. However, when you go to play the game for some reason the camera is in the middle of the sky but you can see your character moving around. Any help would be appreciated cheers.
Server Script
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local Workspace = game:GetService("Workspace")
local charactersFolder = ServerStorage:WaitForChild("Characters")
local function assignRandomCharacter(player)
player.CharacterAdded:Connect(function(originalCharacter)
local characterModels = charactersFolder:GetChildren()
if #characterModels == 0 then
warn("No character models found in the Characters folder!")
return
end
local randomModel = characterModels[math.random(1, #characterModels)]
local newCharacter = randomModel:Clone()
newCharacter.Name = player.Name
newCharacter.Parent = Workspace
local newPrimaryPart = newCharacter:FindFirstChild("HumanoidRootPart") or newCharacter:FindFirstChild("PrimaryPart")
if not newPrimaryPart then
warn("No PrimaryPart or HumanoidRootPart found in character model!")
return
end
local oldPrimaryPart = originalCharacter:FindFirstChild("HumanoidRootPart")
if newPrimaryPart then
if oldPrimaryPart then
newPrimaryPart.CFrame = oldPrimaryPart.CFrame
else
newPrimaryPart.CFrame = CFrame.new(Vector3.new(10, 0, 0))
end
else
warn("HumanoidRootPart missing from new character for", player.Name)
end
player.Character = newCharacter
end)
end
Players.PlayerAdded:Connect(assignRandomCharacter)
Local Script
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
local playerCamera = workspace.CurrentCamera
playerCamera.CameraType = Enum.CameraType.Custom
playerCamera.CameraSubject = player.Character.Humanoid
playerCamera.FieldOfView = 70
playerCamera.CFrame = player.Character.Head.CFrame
end)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.