Custom Character Issue

Hi!
I’ve made a custom character script.
And i’ve got an issue:
https://gyazo.com/5257b3285de85ee12362494412aa87ee

Sever Script:

local survivor_model = game.SStorage.Survivor

game.Players.PlayerAdded:Connect(function(plr)
	plr.Character = nil
	local new_char = survivor_model:Clone()
	new_char.Parent = workspace
	new_char.Name = plr.Name
	plr.Character = new_char
	new_char.Animate.Disabled = false
	
	set_appearance(plr.UserId, new_char)
end)

respawn.OnServerEvent:Connect(function(plr)
	workspace[plr.Name]:Destroy()
	delay(0.5, function()
		plr.Character = nil
		local new_char = survivor_model:Clone()
		new_char.Parent = workspace
		new_char.Name = plr.Name
		plr.Character = new_char
		new_char.Animate.Disabled = false
		
		set_appearance(plr.UserId, new_char)
	end)
end)
1 Like

Someone might be able to better answer this, but you may need to set Camera.CameraSubject to the new humanoid. You would want to do this in a LocalScript.

Let me know if this helps.

1 Like

Did you try to set the humanoid health to 0 and not literally destroy the player from workspace? You could also use CharacterAdded to get the character of player.

The camera will automatically assume on the new character if you set a new character.

The real issue is that the character loading is in completely wrong order. Therefore the character loaded in the new respawn is wrong. Also try disabling CharacterAutoLoads in Players first to see if this issue also encountered in the first spawn.

@ArticGamerTV This does not solve the issue, intended custom character as in the title and it is apparently a custom character loading logic.

1 Like

Exactly logic is not in correct order that’s why it might load in correct order if we don’t literally destroy the player from workspace but we literally do create a new player with new humanoid and then reconstruct the character with the custom one.

What is set_appearance anyways? It’s a function, but it does not clarify its functionality.


There are a few solutions:

A - Cosmetics only: Help with loading custom characters
B - Parent the character last and change the properties prior to setting character to player.


On the other hand, if someone spams the button while respawning, you may experience that the player(s) loading their character repeatedly, thus it is one unsecure remote.

I think it is plr.CharacterAppearanceId I tried and in output I get that Animate is not a valid member of model.

That might be an issue of the animate script loading slower than what the script can find the animate script. WaitForChild() should probably be used.

set_appearance is setting a player’s outfit to survivor_model
My only issue is camera

I don’t get any errors in output

The Animate property has to be an script inside of this custom character that’s why it’s disabling it to false. Maybe he is not using the correct animate script for correct character type?

@Sunx_x Do you get any error in output? Edit: Got Humanoid to work with this animate script:

Replace the Animate script with this one and try again.

I use R6 character
also no errors

Try to replace your Animate script with this script:

After disabled and re-enabling the script. animate works again, i can easily do that in script.
The main issue is camera

Then I’d do a localscript in startergui make a new remoteclient event and fire next code once custom character is implemented:

 game.Workspace.CurrentCamera.CameraSubject = game.Workspace:WaitForChild(plr.Name):FindFirstChild("Humanoid")
 game.Workspace.CurrentCamera.CameraType = "Custom"

I hope this helps. :herb:

Already tried that, still camera brokes

Interesting. Could you perhaps print() those values when the RemoteEvent fires, and let us know the output?

EDIT: I’m assuming that you are using the default camera script, correct?

As I already told you you don’t want to remove player from workspace so the code should look like this:
Replace this:

Replace it with this:

workspace[plr.Name]:FindFirstChild("Humanoid").Health = 0

Add LocalScript in StarterGui:

game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"

And you don’t have to use RemoteEvents for this.
This works for me. I hope it helps for you as well.

I fixed that issue.
Thanks everyone who helped.

I used a bindable event, since my game has round system. It fires the event and the player spawns. (the camera fixes themself, the animate are moved to startergui.)

It’d be good if you could put an official explanation in this message :slightly_smiling_face:
How did you fix it & what was the problem?

It’ll help other people who stumble across the post in the future looking for help.

Yea, just edited the post, you can see the fix.

1 Like