How to go about making a "character selection" system?

So i have to make this character selection system where the player will click GUI and their starter charcter will change. I created a system but it seems to be very buggy and broken?

Heres the code if anyones interested

Client

repeat task.wait(1) until game:IsLoaded() task.wait(1)

local guiObject = script.Parent
local guiParent = script.Parent.Parent
local guiParent2 = script.Parent.Parent.Parent.MenuScreen

local event = game:GetService("ReplicatedStorage").CharacterSelectionEvent
local charCam = game.Workspace["Pyros Cameras"].CharacterCamera.RP
local currentCam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local TS = game:GetService("TweenService")

guiObject.Activated:Connect(function(inputObject)
	currentCam.CameraType = Enum.CameraType.Scriptable
	guiParent.Enabled = false
	guiParent2.Enabled = false

	print("Character 1 Selected")
	event:FireServer()
	task.wait(.5)
	-----------------
	currentCam.CFrame = charCam.CFrame
	local char = player.Character
	local HRP = char.HumanoidRootPart
	local hum = char.Humanoid
	local tweem = TS:Create(currentCam, TweenInfo.new(1), {CFrame = HRP.CFrame})
	tweem:Play()
	tweem.Completed:Connect(function()
		currentCam.CameraSubject = hum
		currentCam.CameraType = Enum.CameraType.Custom
	end)
end)

Server

local event = game:GetService("ReplicatedStorage").CharacterSelectionEvent
local RepSto = game:GetService("ReplicatedStorage")

event.OnServerEvent:Connect(function(plr)
	print(plr.Name, "has chosen Character 1!")
	local plrGUI = plr.PlayerGui
	local char = plr.Character
	local newChar = RepSto.StarterCharacters:WaitForChild("CamiloCharacter"):Clone()
	local oldCF = char:GetPrimaryPartCFrame()
	
	newChar.Name = "StarterCharacter"
	newChar.Parent = game.Workspace
	newChar:SetPrimaryPartCFrame(oldCF)
	plr.Character = newChar
	plrGUI.MenuScreen.Enabled = false
	plrGUI.MenuScreen.Background["Play!"]["Play Script"].Disabled = true
	char:Destroy()
end)

The scripts shown above “work” but there are a few bugs and i dont exactly know what the issue is.

  • If a player tries to reset they get stuck and dont reset
  • Animations wont play

With this being said, i wonder if my way of going about it entirely was wrong. So my question is how do i create an effective character selection system?

Help is greatly appriciated, thank you for your time :slightly_smiling_face:

For this you could disable the reset button. That’s all I can help with.

1 Like

Are the character’s completely custom rigs, or are they just R6/R15/Arthro characters with different accesories/clothing. If they are still roblox characters (not custom rigs), I would suggest using the HumanoidDescription system.

https://developer.roblox.com/en-us/api-reference/class/HumanoidDescription

https://developer.roblox.com/en-us/api-reference/function/Humanoid/ApplyDescription

2 Likes