Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

what is the best way to make Custom Character depending on Player Race?

Asked by 2 years ago
Edited 2 years ago

im trying to make a script that changes player body to a "monster like" depending on the race, there is 4 of these monsters, each one with a specific body, i did it with a ServerScript and doing this:

if race.Value == "hollow" then
    local newChar = hollow:Clone()
    newChar.Name = plr.Name
    newChar.Parent = W
    newChar.PrimaryPart = newChar.HumanoidRootPart
    newChar.PrimaryPart.CFrame = plr.Character.PrimaryPart.CFrame
    plr.Character = newChar
    game.ReplicatedStorage:WaitForChild("CameraFix"):FireClient(plr)
end

its the best way? make in a ServerScript and do all these things or theres a way to just change the player "StarterCharacter"? i think in a LocaScript, something like "if your race is X, ill clone the X body in your StarterPlayer and rename it StarterCharacter" what u guys think about it?

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

I'm no expert at all, but I would probably put the monster bodies in something like replicated storage or whatever, and run something like this:

if race.Value ~= nil then
    local body = game.ReplicatedStorage:FindFirstChild(Race.Value):Clone()
    body.Parent = newChar
    --everything else blah blah
    print("Mwahaha you are now a... "..race.Value.."!!!")

That way you aren't running numerous "if race.Value == this, and if race.Value == that", etc.

0
i need those "if race.Value == this then do this", because its 4 monsters and each one is for a specific level and have specific body, so i cant just do "race~=nil" and make 1 morph, this is not what i want, and "hollow" in my script is already in ReplicatedStorage Ariirael 15 — 2y
0
Totally, but if you do race.Value ~= nil, then you already know what their monster is because you have race.Value instead of running if-statements. So you could just use race.Value to find the morph out of the 4 in replicated storage. On Line 2 of the code I put, that would find the specific morph out of the 4. barrettr500 53 — 2y
0
Just a suggestion though to make code neater, whatever's easiest for you. barrettr500 53 — 2y
Ad

Answer this question