#Character Loading

1 messages · Page 1 of 1 (latest)

tired stratus
#

Hii I want the character to be loaded in as a model based on which character they chose, during the game only. I already have a working inventory to select the character and a working round system, i just want to know how I'd go about making the local player change into a npc/rig when the round begins.

this is what i have so far and it functions how it should.

#

oh yeah also i have 0 idea why i have loadacharacter at the bottom lol

pine adder
#

simply clothe their character

#

give them shirt/pants color and other accessories

#

if u dont have accessories then weld them

tired stratus
#

Im a bit lost

pine adder
#

ok

#

do u know about shirt and pants and accessory instances

tired stratus
#

Yeees?

pine adder
#

and ur npc rig has those yes?

tired stratus
#

Yes

pine adder
#

when the player spawns

#

clone the npc rig's shirt pants and accessories

#

then parent them to the player character

#

clear the players own accessories beforehand though

tired stratus
#

It would be very messy to do that for every clothing item, accessory, body colour, animation, etc for every character

pine adder
#

why would it be

tired stratus
#

is there a way to just delete the players rig and replace it??

pine adder
#

not sure but far as i know no

tired stratus
pine adder
#

you can use a for loop

#

and turn it into a function

#

use a for loop to loop through your npc rig's descendants

#

then if the descendant is a shirt pants /accessory

#

parent it to the player character

#

want me to show an example

tired stratus
#

Im just asking if theres a way to replace the entire rig though

pine adder
#

far as i know no

tired stratus
#

There has to be though

pine adder
#

well it really depends on ur

#

rig

tired stratus
#

wdym

pine adder
#

but to my knowledge people just clothe/change the players own character

pine adder
#

with different bone structure etc

tired stratus
#

The rigging is the same

#

its just r6

pine adder
#

then u just clothe the character yes

tired stratus
#

and change animations and colour the character

pine adder
#

yeah

#

you dont have to write

#

seperate stuff for every character

#

simply make a function that handles them all

tired stratus
#

Could you hsow an example

pine adder
# tired stratus Could you hsow an example
local PlayerCharacter = ...
local Morph = ...
local function Morph(Character, Morph)
   -- prepare the player rig for morphing
   Character.Humanoid:RemoveAccessories()
    
   local Shirt = Character:FindFirstChildWhichIsA("Shirt")
    if Shirt then
      Shirt:Destroy()
    end

   local Pants = Character:FindFirstChildWhichIsA("Shirt")
    if Pants then
      Pants :Destroy()
    end

    -- put morph stuff to character
    for i,v in Morph:GetDescendants() do
        if v:IsA("Shirt") or v:IsA("Pants") or v:IsA("Accessory") then
           local Clone = v:Clone()
           Clone.Parent = Character
        end      
    end
end

Morph(PlayerCharacter,Morph)

#

dont mind the mistakes wrote it on dc

#

do u have any questions about the code

tired stratus
#

how would it know which player and which rig?

pine adder
#

for which player

#

you can use PlayerAdded and CharacterAdded

#

and for which rig

#

that depends on how ur game works