Help with Morph/Load Custom Character Script

I’m having a problem with the morph/load custom character script. It clones the model needed, however, can’t clone it to the player’s CFrame. Any help is appreciated

function Egg:LoadChar(egg)
	local newEgg = egg:Clone()
	
	newEgg.EggMesh.Anchored = false
	newEgg:SetPrimaryPartCFrame(self._character.PrimaryPart.CFrame)
	
	self._character = newEgg
	
	newEgg.Parent = workspace
end
2 Likes

what is newEgg???
what is egg???
what is newEgg.PrimaryPart?
more info please

1 Like

newEgg, created in the function, is the models clone. Egg is a parameter passed by other functions and newEgg.PrimaryPart is the primary part of the new egg I just created

1 Like

???.
what are the ClassNames??

1 Like

ClassNames? What on earth are ClassNames? I never added such thing

you dont add those roblox does
https://developer.roblox.com/en-us/api-reference/property/Instance/ClassName

A read-only string representing the class this Instance belongs to.

Umm, the egg’s a model, EggMesh is part that has a child mesh

I think you forgot to set the newEgg.PrimaryPart as root part
perhap :sweat_smile:

What do you mean? I already set it

Is morph working, but only to set the CFrame not working ?
:sweat_smile: :sweat_smile:

it gets spawned in somewhere else, and the character stays the same

alright any errors in console ? :no_mouth:

Nope, not at all. Just spawning in a random CFrame. (I wonder whether it’s 0, 0, 0)

I don’t know man. I only know
something like this player.Character = newEgg
bye :sweat_smile:

self._character is equal to the player’s character. So it should work fine.

let say,

local d = workspace.dummy
local c = game.Players.The_flyingMan716.Character --doesn't work
c = d

local d = workspace.dummy
local p = game.Players.The_flyingMan716--work
p.Character = d

:sweat_smile:
bye

Uhm, what? Did you understand the problem?

because you say that self._character is equal to character. This will not work. I need to set to player.Character = model directly for it work. Under player instance has a property call player.Character
:sweat_smile:

Wait what? self._character is pointing directly at the character of the player.

Edit: still doesn’t work anyway, i told you it just gets loaded in a random cframe, no errors

Hello, everybody. I made some more changes to my loading custom character script, yet it doesn’t get loaded and the player’s camera is looking nowhere

function Egg:LoadChar(egg)
	local character = self._player.CharacterAdded:Wait()
	
	local NewCharacter = egg:Clone()
	
	NewCharacter:SetPrimareyPartCFrame(character.PrimaryPart.CFrame)
	
	NewCharacter.Name = self._player.Name
	character = NewCharacter
	
	NewCharacter.Parent = workspace
end