I want to create a system where players on a specific team (“Killer”) get a custom R6 character model instead of the default Roblox character when they spawn. This custom character should have special tools assigned to it automatically. Players not on the “Killer” team should keep their default character and have no tool changes. Also, I want to ensure the camera correctly follows the custom character’s humanoid after spawning.
the issue
- When I replace the player’s character with a custom model for the “Killer” team, the camera sometimes doesn’t follow the new character properly.
- Tools are given but sometimes don’t appear or aren’t equipped correctly.
- If I don’t manage character loading carefully, it causes infinite loops or fails to respawn the character.
- The default Roblox character should be preserved for players who aren’t on the “Killer” team.
I have attached the code I’m currently using (see below). It mostly works but camera and tool issues remain.
i tried so many that in my time line about to goes dark
- Set
game.Players.CharacterAutoLoads = falseto control character spawning manually. - Clone the custom character from
ServerStorage.TeamCharacters.Killerand assign it as the player’s character. - Gave tools stored in
ServerStorage.Toolsdirectly into the cloned character. - Manually set the camera’s
CameraSubjectto the new humanoid. - Used
Player:LoadCharacter()for non-Killer teams to preserve default behavior. - Added respawn logic to handle character deaths properly.
I reviewed the Roblox Developer Hub and related tutorials on custom character rigs, tool parenting, and camera control, but struggled to get a clean, bug-free implementation that covers all my needs
also this is base for my script
and here is my script
game.Players.CharacterAutoLoads = false
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local Teams = game:GetService("Teams")
local StarterCharacterScripts = game.StarterPlayer.StarterCharacterScripts:GetChildren()
local TeamCharacters = ServerStorage:WaitForChild("TeamCharacters")
local KillerTeam = Teams:WaitForChild("Killer")
local KillerSpawn = workspace:WaitForChild("KillerSpawn")
local RespawnTime = 3
local TOOL_NAMES = {"Claws", "Pounce"}
local function setupCamera(character)
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = character:WaitForChild("Humanoid")
end
local function giveTools(character)
local toolsFolder = ServerStorage:FindFirstChild("Tools")
if toolsFolder then
for _, toolName in ipairs(TOOL_NAMES) do
local tool = toolsFolder:FindFirstChild(toolName)
if tool then
local toolClone = tool:Clone()
toolClone.Parent = character
end
end
end
end
local function spawnPlayer(player)
if player.Team == KillerTeam then
local killerTemplate = TeamCharacters:FindFirstChild("Killer")
if killerTemplate then
local charClone = killerTemplate:Clone()
charClone.Name = player.Name
for _, script in ipairs(StarterCharacterScripts) do
script:Clone().Parent = charClone
end
charClone:PivotTo(KillerSpawn.CFrame + Vector3.new(0, 5, 0))
charClone.Parent = workspace
player.Character = charClone
setupCamera(charClone)
giveTools(charClone)
end
else
player:LoadCharacter()
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local humanoid = char:WaitForChild("Humanoid")
humanoid.Died:Connect(function()
task.wait(RespawnTime)
spawnPlayer(player)
end)
end)
spawnPlayer(player)
end)
also i don’t know how to get tool to work with it