StarterCharacter doesn't appear

I am trying to make a script that makes your character have a custom by clicking on a Gui button, the problem is that it spawns with the proposed items but not with the morphs.

  • LocalScript located in TextButton (Gui)
local Player = game:GetService("Players").LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if Player.leaderstats.Rank.Value == "Security Cadet" then
		game.ReplicatedStorage.Event.Morpher:FireServer("Cadet")
	end
end)
  • Script located in StarterCharacterScripts
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

game.ReplicatedStorage.Event.Morpher.OnServerEvent:Connect(function(player, rankName)
	if rankName == "Cadet" then
		local Morph = ServerStorage.Morph.SED.Morphs.Security1Guard:Clone()
		local L2 = ServerStorage.Itens["[NC] Level-2"]:Clone()
		local LC = ServerStorage.Itens["[NC] Level-C"]:Clone()
		local Beretta = ServerStorage.Itens["Beretta 92fs"]:Clone()
		local Radio = ServerStorage.Itens.Radio:Clone()
		Morph.Name = "StarterCharacter"
		player.Character = Morph
		player.Character.Parent = workspace
		player:LoadCharacter()
		L2.Parent = player.Backpack
		LC.Parent = player.Backpack
		Beretta.Parent = player.Backpack
		Radio.Parent = player.Backpack
4 Likes

I assume your second script is a server script so it needs to be in ServerScriptService or Workspace to run.
However, If the character has not yet spawned, the character model won’t be in workspace, the script won’t be available and won’t be able to run.

So I would move this to the ServerScriptService.

3 Likes

Well, now I spawn with it however it next second, for some reason it respawns again and then I lose the morph but not the itens.

1 Like

It might be because you parent the character model to the workspace then call LoadCharacter.
Try just keeping the loadCharacter.

1 Like

Still not, for some reason it commits same problem, now it doesn’t even show the morph for an second.

You could try the other way around.

If that doesn’t work, then you will need to parent the morph to the StarterPlayer folder for LoadCharacter to work.

1 Like

That was also another problem, it was inicially to the StarterPlayer, however, supossing to be only for me, it morphed for everyone in the same server and also for the people who joined the server would receive the morph. (This only happening if the first person morphs himself)

Nevermind, I removed > player:LoadCharacter()
And now this works.
image

Thanks for helping me. :slightly_smiling_face:
|||||||||||||||||||||||||||

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.