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

How do you make a script to change your character's armor? [SOLVED]

Asked by 10 years ago

I am working on a game but I need help with the script. I was hoping it would be like the minecraft inventory thing but it changes the charafters outfit in the game only. Help?

1 answer

Log in to vote
2
Answered by 10 years ago

Hi!

First of all, you would need to remove all traces of the current character. Meaning removing hats, body colors (optional), shirt, pants, t-shirt, face (optional), and packages.

Hats' classname is called 'Hat', Shirts are 'Shirt', Pants are 'Pants', T-Shirts require two deletions, 'ShirtGraphic', and a decal inside the torso, the face is a decal inside the head, and finally, Packages are 'CharacterMesh'.

I don't know the exact conditions for the removal of these things, however...

You'd need to check if all objects in the head, torso, or character itself are one of these things, then delete them.

Create new ones with the Instance.new function, and surround all of it within functions that reload each time a character respawns.

This is an old script of mine you can reference if you need it:

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
for a,b in pairs(char:GetChildren()) do

                    if b:IsA("Shirt") or b:IsA("Pants") or b:IsA("ShirtGraphic") or b:IsA("Hat") or b:IsA("CharacterMesh") or b.Name == "Bit" then

                        b:Destroy()

                    elseif b:IsA("BodyColors") then

                        b.HeadColor = BrickColor.new("Dark stone grey")
                        b.TorsoColor = BrickColor.new("Earth green")
                        b.LeftArmColor = BrickColor.new("Dark stone grey")
                        b.RightArmColor = BrickColor.new("Dark stone grey")
                        b.LeftLegColor = BrickColor.new("Earth green")
                        b.RightLegColor = BrickColor.new("Earth green")



                    end

                    char.Head.face.Texture = ""


                    if char.Torso:findFirstChild("roblox") then

                        char.Torso:findFirstChild("roblox"):Destroy()

                    end


                end
end)
end)

^ This turns the character into a 'zombie'-esque looking thing.

I hope I could help, good luck! And please consider leaving me an upvote!

Ad

Answer this question