Hello, so i have 2 models for custom rigs, one being a female rig and the other a male rig. I have a character customization system and i want it so that if they choose female, their character changes to the female rig and vice versa. Im not sure how to go about it becuase i cant just take The Male starter character out of StarterPack and put the female one in because it wouldnt change, so im not sure how to go about it.
Put the the two models in serverstorage, when a player joins the game, it gives them a gui prompt with two buttons, those buttons now determine their character.
For example, if a player clicked the “Male” Button.
local player = game:GetService(“Players”).LocalPlayer
local MaleChar = game:GetService(“ServerStorage”).MaleModelscript.Parent.MouseButton1Click:Connect(function()
MaleChar.Parent = workspace
player.Character:Destroy()
player.Character = MaleCharend)
Okay, will this allow the person to keep their accessories they may have had on the other character
By their code no, but you could run a loop using getchildren through the old players character and check for every instance that is a Accessory/etc before destroying it.
It doesnt work, and also by destroying the character it gives a since that your dying, and i just want your character to change appearance
By appearance, do you mean fully body change or accessory change like outfit?
Fully body. (just random stuff cause of word limit)
Oh I see, well you could just use a for i, v pairs and replace every part in the character with the custom charaacter
But for the male a female character the scaling is different and stuff
Could you make a male button for the male model and try this script
local StarterGui = game:GetService("StarterGui")
local player = game:GetService(“Players”).LocalPlayer
local MaleChar = game:GetService(“ServerStorage”).MaleModel
script.Parent.MouseButton1Click:Connect(function()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false) -- this removes death ui
player.Character = MaleChar
MaleChar.Parent = workspace
task.wait(1)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, true) --- this brings back death ui
end)
Whenever i join the game, nothing is in server storage so it cant find the model
well server storage is invisible to the client but is always there on the server
Well, for some reason, it cant find it
Oh i know, i have the scriot indiaxe of a local script. Is that why?
yes it’s supposed to be a server script or you could use a local script to fire a remote event
Use startercharacters
Add a custom male and female rig into serverstorage
Then use a server script in a text button or something and when they click something like this happens:
--male character
local char = game.StarterPlayer:FindFirstChild(“StarterCharacter”)
if char then
char:Destroy()
end
local m = game.ServerStorage.Male:Clone()
m.Parent = game.StarterPlayer
m.Name = “StarterCharacter”
for female character:
--female character
local char = game.StarterPlayer:FindFirstChild(“StarterCharacter”)
if char then
char:Destroy()
end
local m = game.ServerStorage.Female:Clone()
m.Parent = game.StarterPlayer
m.Name = “StarterCharacter”
You would want to name the characters “Male” and “Female” unless you have names for them.
Oh yeah, if you want to make them change whilst alive, you can add this at the end
local plr = path_player_here
local cf = plr.Character.PrimaryPart.CFrame
plr:LoadCharacter
plr:SetPrimaryPartCFrame(cf)
well i mean yeah ig, but I was asking for if the press the buttons
also, this script doesnt work with a serverscript, it cant find the character
ok so, i did it, i didnt use anything from this post but yeah i did it