So I’ve been trying to fix this small issue for the past hour or so and it seems that my script that changes the players appearance isn’t working.
game.ReplicatedStorage.RemoteEvents.RequestCharacterChange.OnServerEvent:Connect(function(plr,IsMan)
print("C2")
if IsMan == true then
plr.Character = game.ReplicatedStorage.Characters.Man:Clone()
plr:LoadCharacter()
else
plr.Character = game.ReplicatedStorage.Characters.Woman:Clone()
plr:LoadCharacter()
end
end)
Does anyone have any ideas?
IggyDev
(Iggy)
May 11, 2021, 10:56pm
#2
This is most likely an issue with your character, could you send the characters you’re using?
Edit: You are not setting the character’s parent! Make sure to clone the character into the workspace!
This might be due because when you clone an Instance, it’s parent will automatically be set to nil
so you’ll need to set it’s parent first I believe?
game.ReplicatedStorage.RemoteEvents.RequestCharacterChange.OnServerEvent:Connect(function(plr,IsMan)
print("C2")
if IsMan == true then
local Clone = game.ReplicatedStorage.Characters.Man:Clone()
Clone.Parent = workspace
plr.Character = Clone
plr:LoadCharacter()
else
local Clone = game.ReplicatedStorage.Characters.Woman:Clone()
Clone.Parent = workspace
plr.Character = Clone
plr:LoadCharacter()
end
end)
Also could be because you have CharacterAutoLoads
enabled, not sure
IggyDev
(Iggy)
May 11, 2021, 10:57pm
#5
Yeah, you should parent the player to the workspace.
Still doesn’t work. And CharacterAutoLoads is true. True or false it still doesn’t work
Try adding a couple of print statements to check that IsMan
is a valid variable?
The prints print accordingly…
Why set the parent to workspace? that’s not where the players appearance located (just read your code whats up with the redundancy lol)
Perhaps try parenting it to the plr
game.ReplicatedStorage.Characters.Man:Clone().parent=plr.character
or just try to enter the plr character and individually change (remove) the contents (meshes or whatever it is you need) of plr and reinstate whats inside clone()
OP I would probably do the reinstate method and change everything individually also yea @iamtryingtofindname is right, the load character basically respawns the player which makes the previous code null because the contents are gone from the player
Straight from the DevHub:
The LoadCharacter Player
function creates a new character for the player, removing the old one. It also clears the player’s Backpack
and PlayerGui
.
See more here
Basically you are editing the character, but by calling LoadCharacter, you are creating a new character, over writing the old one.
I don’t know why everyone here thinks it has to do with parenting the character, as that is incorrect and has nothing to do with the issue.
1 Like