Problems with character selection system

Im trying to create a “character selection” system where the player can click on a gui object and their character will change. Ive been having some issues with it tho.


The model is invisible for some reason,
the camera doesnt move to the new characters model.
the model cant move

The GUI gets enabled for some reason?

Im not sure what im doing wrong. This is my first time with messing with startercharacters :sweat_smile:

Heres my code
Client-

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

local guiObject = script.Parent
local guiParent = script.Parent.Parent
local event = game:GetService("ReplicatedStorage").CharacterSelectionEvent

local currentCam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer

guiObject.Activated:Connect(function(inputObject)
	guiParent.Enabled = false
	print("Character 1 Selected")
	event:FireServer()
	task.wait(5)
	currentCam.CameraType = Enum.CameraType.Custom
end)

Server

local event = game:GetService("ReplicatedStorage").CharacterSelectionEvent
local RepSto = game:GetService("ReplicatedStorage")
local camera = game.Workspace.CurrentCamera
event.OnServerEvent:Connect(function(plr)
	print(plr.Name, "has chosen Character 1!")
	local char = plr.Character
	local newChar = RepSto.StarterCharacters:WaitForChild("CamiloCharacter"):Clone()
	local oldCF = char:GetPrimaryPartCFrame()
	
	newChar.Parent = game.Workspace
	newChar:SetPrimaryPartCFrame(oldCF)
	plr.Character = newChar
	char:Destroy()
	camera.CameraSubject = newChar.Humanoid
end)

Help would greatly be appreciated. Thank you for your time :slightly_smiling_face:

Changing the CurrentCamera via the server will only update the ServerCamera not the Clients CurrentCamera

1 Like