#Character selection

1 messages · Page 1 of 1 (latest)

full frost
#

How would i make this script turn the player into the character they have selected? Where do I store the character? I have it o that I can open the character selection, press the character and have that print the name. It can also close correctly. Also how would i have what they selected and save it for next time they join?

#

Also i do have work soon so i might go unresponsive

trail swallow
#

i believe youll need a server script for that
changing a characters appearance locally wouldnt replicate it to other players
use a remote event for that

#

you can change a characters midgame simply by using plr.Character

#

just gotta remember
you also have to assign the camera propety,making sure new character is unanchored,clear up the old char and transfer scripts inside old char to new one

#

just in case ill make you a simple code

trail swallow
#

local script:

local remote = --remote event,preferably inside replicated storage
--say the "CloveSelected" function is where you wanna change character
function CloveSelected()
remote:FireServer("AssignCharacter")
end
function CameraAssign(char)
local camera = workspace.CurrentCamera
camera.CameraSubject = char.Humanoid.CameraSubject
end
cloveselect.Activated:Connect(CloveSelected)
remote.OnClientEvent:Connect(CameraAssign)

server script(inside serverscriptstorage):

local remote = --remote event position
local CloneChar = --clone char position

function AssignCharacter(plr,call) do
if call == "AssignCharacter" then
local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char.HumanoidRootPart
if not plr then return end
local clone = CloneChar:Clone()
clone.Parent = game.Workspace
clone.Position = hrp.Position
clone.Name = char.Name
plr.Character = clone
for i,v in pairs(char:GetDescendants()) do
if v:IsA("Script") then
v.Parent = clone
end
end
char:Destroy()
remote:FireClient(plr,clone)
end
remote.OnServerEvent:Connect(AssignCharacter)