Load A Custom Character Through Script


For a while now, I’ve been attempting to make a custom character loader, which could apply the rig to a specific person with a specific UserId.

I have tried several methods. However, none of them seem to work efficiently.

The closest I’ve gotten was using a method that users a local script, server script, and remote event, all placed in startergui:

Local Script:

local plr = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local rig = game.Workspace.Barb
local plrID = game.Players:GetUserIdFromNameAsync(plr.Name)

if plrID == 535755127 then
    camera.CameraType = "Follow"
    camera.CameraSubject = rig.HumanoidRootPart

Server script:

local dontrepeat


	local char = plr.Character
	local rig = game.Workspace.Barb

	if not rig.HumanoidRootPart:FindFirstChild("DontRepeat") then
		plr.Character = rig
	if not rig.HumanoidRootPart:FindFirstChild("DontRepeat") then
		dontrepeat = Instance.new("Attachment")
		dontrepeat.Name = "DontRepeat"
		dontrepeat.Parent = rig.HumanoidRootPart

And while this somewhat worked, when I apply an animation script, it’s very delayed, and on some rigs, the walking animation doesn’t even work.

If anyone knows a more efficient way to load a custom character through a script, that would be helpful. Thank you!

1 Like

Well it the animation script delays because the character has just recently loaded and it takes several seconds or less to make it play.

I’m assuming that about some rigs that makes the walking animation not working, probably it’s the motor 6d with different names.

Would you happen to know a method that would reduce the delay?

I’ll try that when I get a chance, thanks!

  1. How do you play the animation and where is the function that plays the animation?

  2. Well that method doesn’t works because you said it’s not playing so it’s definitely not that so I apologize for false help. Well anyway about that don’t try that and I’ll still think it. I’ll notify you if I know why.

CameraType is a Enum by the way.

I use the animation script that is given to players when they join the game, and turned it into a serverscript so it would play.

You can also play it in localscript and will cause less delays unless it’s an npc.

Really? I believe I tried that and it didn’t work.

Although would it really help with the overall problem?

Hey! After 2 weeks, I’ve realized it’s a lot simpler than I thought!

All you need is this script in server script service:

	if player.UserId == YourUserIdHere then -- If you're not trying to make it a specific user, then just delete this if statement
		local character = game.ServerStorage.Barb:Clone()
		character.Name = player.Name
		player.Character = character
		character.Parent = workspace

When I first started working on this, I had originally used this method. However, it never worked. I believe the issue was that since it’s a PlayerAdded event, I should use a wait() in the LoadCharacter function, which solved the problem for me!

1 Like