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

Applying Character Mesh from Catelog upon CharacterLoad?

Asked by 7 years ago
Edited 7 years ago

I've looked through SH, Wiki, free models, etc and still no luck.

I want to give my players the https://www.roblox.com/catalog/343617819/Rogue-Space-Assassin outfit when they spawn. I know how to change clothes, faces, etc but not CharacterMesh's.

Maybe i can put the id you see in the url in an asset url, I've tried, is there a specific url i should use for packages?

Summary: OnCharacterLoad, change character mesh to Rogue-Space-Assassin or other ROBLOX package.

Thanks in advance.

0
I've found this url, "https://www.roblox.com/Game/GetAssetIdsForPackageId?packageId = 343617819" which could help. How would i match the given id's to the needed part? windows65 2 — 7y

1 answer

Log in to vote
2
Answered by
nilVector 812 Moderation Voter
7 years ago
Edited 7 years ago

You would need to make use of CharacterMesh objects for each individual body part (left arm, left leg, torso, etc.) and parent them to the player's Character.

Here's how you can do it through a normal server-script:

-- When a player enters the server
game.Players.PlayerAdded:connect(function(player)
    -- Removes player's ability to load his/her appearance
    player.CanLoadCharacterAppearance = false
    -- When the player's character loads
    player.CharacterAdded:connect(function(character)
        wait(0.5) -- Half a second delay to give time to load the Character

        -- Creates a new CharacterMesh, adds it to the character
        local leftArm = Instance.new("CharacterMesh", character)
        leftArm.BodyPart = "LeftArm" -- Attaches it to the left arm
        leftArm.MeshId = 343575282 -- Sets its mesh ID
        leftArm.OverlayTextureId = 343563402 -- Sets its texture ID

        local rightArm = Instance.new("CharacterMesh", character)
        rightArm.BodyPart = "RightArm"
        rightArm.MeshId = 343575392
        rightArm.OverlayTextureId = 343563402

        local leftLeg = Instance.new("CharacterMesh", character)
        leftLeg.BodyPart = "LeftLeg"
        leftLeg .MeshId = 343575129
        leftLeg .OverlayTextureId = 343563402

        local rightLeg = Instance.new("CharacterMesh", character)
        rightLeg.BodyPart = "RightLeg"
        rightLeg .MeshId = 343574993
        rightLeg .OverlayTextureId = 343563402

        local torso = Instance.new("CharacterMesh", character)
        torso.BodyPart = "Torso"
        torso.MeshId = 343572790
        torso.OverlayTextureId = 343563402
    end)
end)

I've gone through the trouble of finding the MeshIds and OverlayTextureIds of each body part for you, but if you want to do this for another package, you would have to find them yourself (by searching for the package in free models and looking through the model and its CharacterMesh objects). I'm assuming you know how to add/remove players' hats, so I'll let you do that part.

Hope this helps! if it does, don't forget to click "Accept Answer" and +1 my Rep!

1
Excellent answer, thank you! I'll up-vote as soon as I am able to. 5 Rep needed. Thanks again. Did not expect such a good answer. windows65 2 — 7y
0
No problem. nilVector 812 — 7y
Ad

Answer this question