How to make armor in roblox

Help and Feedback Scripting Support

So I have tested welding a random part to a player and it worked but when I walk it moves back because its not perfectly with the position of the humanoidrootpart so now I am asking how do I weld a part exactly on the player

1 Like

Use attachments to get the perfect relative position for positioning just like the default Humanoid accessory system.

You can use a normal weld or RigidConstraint, they function the same and the math is the same as well.

Rigid Constraint:

https://doy2mn9upadnk.cloudfront.net/uploads/default/original/4X/a/d/5/ad5b3e00e71b234f9b451babcea0f02bb55336fb.mp4

Weld formula which does the same effect:

How to make armor in roblox
Basics of CFrame multiplication and Welds/Motor6Ds/Joint Instances

And you can even do it by script using the original weld Instance:

local weld = Instance.new("Weld") weld.C0 = attachment0.CFrame weld.Part0 = attachment0.Parent weld.C1 = attachment1.CFrame weld.Part1 = attachment1.Parent weld.Parent = attachment1.Parent --any parent under workspace to make the weld active

well as said when using welds the part will move back a bit when moving

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to make an Armor and Health system and I wanna know how I would make it so if a player has armor then it will damage the armor value but if the armor is below 0 then it will damage the health. For example, is if I have 30 Armor and 100 health and we damage the armor by 40 we would have -10 armor and I wanna take away health by that amount.

Server Script:

local Main = require(script.Parent.MainModule) local RE_Health = game.ReplicatedStorage.Health -- Health RemoteEvent -- Assigns Health/Armor Values to players. game:GetService("Players").PlayerAdded:Connect(function(plr) local Health = Instance.new("IntValue") Health.Name = "Health" Health.Parent = plr Health.Value = 100 local Armor = Instance.new("IntValue") Armor.Name = "Armor" Armor.Parent = plr end) RE_Health.OnServerEvent:Connect(function(plr, Health, Armor) Main.DamagePlayer(plr, 40) end)

Local Script:

local RE_Health = game.ReplicatedStorage.Health local plr = game.Players.LocalPlayer local Health = plr.Health local Armor = plr.Armor local Healthbar = script.Parent.Background.Healthbar local Armorbar = script.Parent.Background.Armorbar Health.Changed:Connect(function() -- Detects if health value has changed Healthbar:TweenSize(UDim2.fromScale(Health.Value/100, 1), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.3, true) RE_Health:FireServer(Health.Value, Armor.Value) -- Gives the server the health and armor values end) Armor.Changed:Connect(function() -- Detects if armor value has changed Armorbar:TweenSize(UDim2.fromScale(Armor.Value/100, 0.5), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.3, true) RE_Health:FireServer(Health.Value, Armor.Value) -- Gives the server the health and armor values end)

Main Module Script:

local module = {} function module.DamagePlayer(plr, Damage) if plr.Armor.Value >= 0 then plr.Armor.Value -= Damage if plr.Armor.Value < 0 then local LeftOver = plr.Armor.Value + plr.Health.Value plr.Health.Value = LeftOver plr.Armor.Value = 0 end else plr.Health.Value -= Damage end end return module

Feel free to point out any mistakes I have made

Help and Feedback Scripting Support

Hey there!

I’m a Roblox Programmer and I would like to script armors like in Dungeon Quest…

I already know everything related to the inventory and on the equip system…

But I don’t know how to make the armor and how to fix it on the player’s character.

I thought using attachments is the best way to make it!

What do you think about it? Are attachments the best way to make this?

4 Likes

Using attachments with Accessorys is the best way to put it on the character.

Take this as an example I fixed these on there perfectly with Accessorys.

How to make armor in roblox

1 Like

I like it a lot! But are the armors one piece or many parts? So the armor (without the helmet) is fixed on each attachment?

They are many parts in like a group. That one group is all welded together and placed into an accessory with the correct attachment. So for each part on the body you would like to cover up with armor would be one group of parts. To elaborate a little more the armor would be many parts.

1 Like

Mhh, so if I want the armor to follow the legs and the arms, I’m obliged to split the armor and the attachment between different parts? So I have to have an accessory welded on the left lower leg and another on the right lower leg… ?

I made a basic armor, each parts have a different color, how am I supposed to transform it into a working accessory?

How to make armor in roblox

You can weld this to the body part instead, that way it can behave as a part in the body. You can read more about welds here.Welds

Hey I’m back!

I achieved something!

Here is a bad evolved version of my latest version :

How to make armor in roblox

As you can see I can use it!

But It’s not with a script.

The helmet is an accessory and it’s working perfectly, but I don’t really know how to weld all my parts to the body parts…

So I did this:

How to make armor in roblox

I think there is a better way to do this?

How can I equip my armor from a script?

2 Likes

You need to weld the parts manually through a script using Instance.new and messing around with the weld properties. If it’s a GUI then you’ll have to use RemoteEvents

I second this. This is in fact exactly how Dungeon Quest sets up both its armour and its weapons, using accessories. Accessories are beautiful for attaching items to characters.

All the parts are put into the accessory with a single one acting as the handle. Said handle should have an attachment that matches up to an attachment in the character. Any extra parts get welded to that handle. Then just add the accessory to the character and you’re good to go.

4 Likes

Wich body attachment’s name should I use for my armor? Wich body part has to be the handle? Here is what I did:

How to make armor in roblox

The weldConstraints are for those floating squares:

How to make armor in roblox

When I put the accessory into the character, the uppertorso part goes on the character but the other parts don’t.

Any part can be the handle and any attachment name can be used, those are all things you can figure out and apply to your liking. Parts should not be children of other parts, though their placement in hierarchy is fairly irrelevant - the point is that they need to be welded to the handle and not anchored.

Mh, I’m not sure to understand.

Have I to make one accessory for one armor, or have I to make an accessory for all armor’s parts?

Because, if I make one accessory for all my parts: “All the parts are put into the accessory with a single one acting as the handle.”.

And if I use one accessory for all parts, I don’t understand why the legs’s parts of the armor will follow the leg if I don’t use an other attachment for each?

Is it possible for you, to make a really basic model of an armor with only legs if you want and show me how you manage your armor in the explorer pls???

All your parts go into one accessory that serve as a piece of the armour. Ideally you will need pieces for every limb of R15 (upper and lower torso, upper and lower arms, upper and lower legs, hands and feet) according to what your armour specifications are. One of those parts in the accessory becomes the handle (the root of it) and all other parts are welded to it. Not all of your parts are attaching because you’re probably doing the welding wrong.

Here’s an example I made using one of Roblox’s open sourced models from their weapon kit, a back slung grenade launcher. It’s made to demonstrate an accessory with multiple parts. To see how it looks on your character, follow these steps:

  1. Launch play solo (F5).
  2. Switch to the server view.
  3. Run the code below in the command bar.
  4. Switch to the client view.
  5. Walk around.

Code:

workspace["YOUR_NAME"].Humanoid:AddAccessory(game.ServerStorage.BackSlungLauncher:Clone())

Mh, I’m probably an idiot, but I don’t know where to find the Open sourced models from their weapon kit?

I don’t find the weapon you’re talking about.

So I can’t look how it is in the character.

(sorry)

How to make armor in roblox

1 Like

Knowing where I got the model from is highly irrelevant. The point is that it demonstrates how you can attach a multiple-part accessory to the character, which is the same principle you should adopt for your armour. You can break it down in the explorer and check out how the accessory is stitched together, as well as how the two attachments line up when the accessory is given to the character.

1 Like

I don’t really understand how the Hands will follow if I put all my armor in one single accessory attatched to a humanoidRootPart Attachment.

How the armor part wich covers the right hand will follow?