hey there mikeartsRBLX, I’m wondering if you now have your own free times, I can wait for your help anytime soon, thanks for reading
-mari
Hi there, your gui is broken, perhaps you could try fixing it first so it works and so that I can view exactly what is going on with the armor system that you have here
hello there, I apologize for being to late to reply in this topic, I have fixed things with the armor GUI’s and I assumed that it was an problems with " UIAspectRatioConstraint ", so I have added UIAspectRatioConstraint for all of the possible gui objects in the armor gui, and I have one more issue other then me having problems with equipping the other armors then leggings and hats, the scrolling frame is 3 box wide instead of 4 box wide for some reasons, so it would be nice if you could help me with this issues, thank you so much for noticing my post
HowToRoblox armor system test file.rbxl (185.3 KB)
Assuming that you use a UIGridLayout, Try messing around with the CellPadding and CellSize. If it’s not helpful for you then try getting rid of the UIAspectRatioConstraint and use a plugin that turns the GUI’s size and position into scale or you can do it manually.
As for the Armor script, I have made a simple code that welds.
This is how I do it.
local FakeBodyPart = Instance.new("Part", Character.BodyPart) -- Any body part that you want to put armor in
FakeBodyPart.Size = Character.BodyPart.Size
local FakeWeld = Instance.new("Weld", FakeBodyPart)
FakeWeld.Name == "FakeWeld"
FakeWeld.Part0 = FakeBodyPart
FakeWeld.Part1 = Character.BodyPart -- Again, any body part you want to put armor in
local ArmorPiece -- Define the armor part here, could be the left arm, right arm, and make sure they are separate parts (not a whole union)
local ArmorWeld1 = Instance.new("Weld", Character.BodyPart)
ArmorWeld1.Part0 = ArmorPiece
ArmorWeld1.Part1 = FakeBodyPart
-- Setting the offset
ArmorWeld1.C1 = CFrame.new(0, 0, 0) -- You can put any offset here,
-- So the armor is in proper place
Tell me if this doesn’t work. You may also add boolvalues or modifications.
P.S. Make sanity checks so that your character won’t have double armors. For example:
if IsWearingHelmet.Value == false then
WearArmor("Helmet", Name) -- Example function of equipping armor
elseif IsWearingHelmet.Value == true then
warn("This player is already wearing a helmet!")
return
end
why hello there again, I am sorry if I have interrupted your free time you were having with…
anyways, the reason I have replied to your recent script suggestion is that I have attempted to apply your script suggestion to Modulescript named EquipArmor inside script named armorserver which is also inside ServerScriptService, but things did not go to well again…
(also thank you for suggesting me with editing the Cellpadding and Cellsize section of UIGridLayout, it did actually worked in order and after I have fixed the scrollframe in the armor GUI, I attempted to applying the suggestion you sent in this topic ;> (the reply at the 25/26 page)
so the main problem is that there is issue with the global/local “BodyPart” shown on the script codes below, I were supposed to put any body part I want to put the armor in… but I still does not know how I can make that bodyPart section work…
…so I just put this " local bodyPart = char:FindFirstChild(armorpieces:FindFirstChild(“Torso”, “Legs”, “Head”).Name) " on the " Local bodyPart section… and now it is showing this specific error that says
" 18:42:02.011 Unable to cast string to bool - Server - EquipArmor:6 "… ;<
and the second issue is that in the original script, there was supposed to be an section of codes that gives the player an specific amount of player speed or health as the specific value that is included inside the armor that is inside an Stats Folder inside an armor model…
but the new script suggestion for an EquipArmor module script you replied to me does lack that armor stats feature…
so it would be very nice if you could spare some times to fix the EquipArmor script now gives extra stats to players based on the value inside the armor model and also having an new welding system that has FakeWeld features and setting the offsets…
I will leave this board of script codes from the EquipArmor modulescript that I tried to fix it but failed and you may try to help me improve this script whenever you could, thank you so much for helping me yet again
function equipFunc(plr:Player, armortype:string, armor:string, plrSpawned:boolean)
local char = plr.Character or plr.CharacterAdded:Wait()
local armorpieces = game:GetService("ReplicatedStorage"):WaitForChild("ArmorPieces")
local bodyPart = char:FindFirstChild(armorpieces:FindFirstChild("Torso", "Legs", "Head").Name) -- **I want this line of script to find an body part property that each armor has on it, but I still does not know how I could manages to do it... ;-;**
local FakeBodyPart = Instance.new("Part", char.bodyPart) -- Any body part that you want to put armor in
FakeBodyPart.Size = char.BodyPart.Size
local FakeWeld = Instance.new("Weld", FakeBodyPart)
FakeWeld.Name = "FakeWeld"
FakeWeld.Part0 = FakeBodyPart
FakeWeld.Part1 = char.BodyPart -- Again, any body part you want to put armor in
local ArmorWeld1 = Instance.new("Weld", char.BodyPart)
ArmorWeld1.Part0 = armorpieces
ArmorWeld1.Part1 = FakeBodyPart
-- Setting the offset
ArmorWeld1.C1 = CFrame.new(0, 0, 0) -- You can put any offset here,
-- So the armor is in proper place
if char and char:FindFirstChild("Humanoid") and char.Humanoid.Health > 0 then -- **beyond this point of line, I pasted some chunk of codes from the origin EquipArmor script execpt the welding one since the codes above has already done that.**
local inv = plr:WaitForChild("ArmorInventory")
local equipped = plr:WaitForChild("ArmorEquipped")
local currentArmor = equipped:FindFirstChild(armortype) and equipped[armortype].Value
if armorpieces:FindFirstChild(armortype) and armorpieces[armortype]:FindFirstChild(armor) then
if currentArmor and not plrSpawned then
local healthGain = currentArmor.Stats.Health.Value
local speedGain = currentArmor.Stats.Speed.Value
char.Humanoid.MaxHealth = char.Humanoid.MaxHealth - healthGain
char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed - speedGain
for _, armorpieces in pairs(armorpieces:GetDescendants()) do
if armorpieces.Name == currentArmor.Name and armorpieces.Parent.Parent == armorpieces then
armorpieces:Clone().Parent = inv
break
end
end
currentArmor:Destroy()
end
end
end
end
return equipFunc
The weird thing is why are you defining multiple children in one variable…
local bodyPart = char:FindFirstChild(armorpieces:FindFirstChild("Torso", "Legs", "Head").Name) -- **I want this line of script to find an body part property that each armor has on it, but I still does not know how I could manages to do it... ;-;**
This will definitely error. Just run a loop to check for each bodyparts or use a table. Here it is:
local bodyPartTable = {
"Torso",
"Legs",
"Head"
}
“FindFirstChild” will only look for the first child with the name it is looking for, so defining multiple children with it will error.
You can do something like if you need to manage multiple children at the same time:
for i, v in pairs(Path:GetChildren()) do
if v:FindFirstChild("item you are looking for") then
--do some code
elseif v:FindFirstChild("another item you are looking for") then
-- do some code
end
end
You may also use Path:GetDescendants if you want to look for children inside children, and repeat.
Also I might be able to help you more with your code on the weekends since I’m busy dealing with exams (sigh), but I don’t make completed versions for anyone.
hello there, so firstly, I would want you to have a good rest/or study until the weekends and reply to me on the weekends, but I will leave this reply on this topic today, *you may reply to me on the weekends *
anyways, the reasons I have left this reply on this topic is to issue an error that was happened while I was adding your script suggestion into the EquipArmor module script… so I tried to modify the local bodypart section into the table code you have suggested earlier and also tried to modify the local FakeBodyPart = Instance.new(“Part”, Character.BodyPart) section into into reading the bodypart table in the code line 10 ~ 13 and make the FakeBodyPart get created inside the player character’s body part(Torso/Legs/Head) and weld it with character’s bodypart and so and fourth… but it has issued this error on the output: “invalid argument #2 to ‘new’ (Instance expected, got table)” again…
so the main thing I am trying to achieve is to fix the char:get(“bodyPart”) inside local FakeBodyPart line section to read the player character’s head/torso/legs and successfully create an new FakeBodyPart and successfully be welded with player’s bodypart(head/torso/legs) and make the whole EquipArmor modulescript work someday ;>
thank you so much for reading my replies again in someday and I hope you can have an great weekend this week!
the newly modified script code of the EquipArmor modulescript below:
local armorpieces = game:GetService("ReplicatedStorage"):WaitForChild("ArmorPieces")
function equipFunc(plr:Player, armortype:string, armor:string, plrSpawned:boolean)
local char = plr.Character or plr.CharacterAdded:Wait()
local inv = plr:WaitForChild("ArmorInventory")
local equipped = plr:WaitForChild("ArmorEquipped")
local currentArmor = equipped:FindFirstChild(armortype) and equipped[armortype].Value
local bodyPart = {
print(char["Torso"]),
print(char["Head"])
}
local FakeBodyPart = Instance.new("Part", char:get("bodyPart")) -- Any body part that you want to put armor in [(I tried to change the local bodypart line to table code you suggested before and also tried to modify the
-- local FakeBodyPart = Instance.new("Part", Character.BodyPart) section into reading the local bodyPart tables in the code line 10~13 but it showed this error on the output: *invalid argument #2 to 'new' (Instance expected, got table)*...)]"
FakeBodyPart.Size = char.BodyPart.Size
local FakeWeld = Instance.new("Weld", FakeBodyPart)
FakeWeld.Name = "FakeWeld"
FakeWeld.Part0 = FakeBodyPart
FakeWeld.Part1 = char.BodyPart -- Again, any body part you want to put armor in
local ArmorWeld1 = Instance.new("Weld", char.BodyPart)
ArmorWeld1.Part0 = armorpieces
ArmorWeld1.Part1 = FakeBodyPart
-- Setting the offset
ArmorWeld1.C1 = CFrame.new(0, 0, 0) -- You can put any offset here,
-- So the armor is in proper place
if inv:FindFirstChild(armor) then -- **beyond this point of line, I pasted some chunk of codes from the origin EquipArmor script execpt the welding one since the codes above has already done that.**
inv[armor]:Destroy()
end
local newarmor = armorpieces[armortype][armor]:Clone()
local newHealthGain = newarmor.Stats.Health.Value
local newSpeedGain = newarmor.Stats.Speed.Value
char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + newHealthGain
char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed + newSpeedGain
if char.Humanoid.Health > char.Humanoid.MaxHealth then
char.Humanoid.Health = char.Humanoid.MaxHealth
end
if char and char:FindFirstChild("Humanoid") and char.Humanoid.Health > 0 then
if armorpieces:FindFirstChild(armortype) and armorpieces[armortype]:FindFirstChild(armor) then
if currentArmor and not plrSpawned then
local healthGain = currentArmor.Stats.Health.Value
local speedGain = currentArmor.Stats.Speed.Value
char.Humanoid.MaxHealth = char.Humanoid.MaxHealth - healthGain
char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed - speedGain
for _, armorpieces in pairs(armorpieces:GetDescendants()) do
if armorpieces.Name == currentArmor.Name and armorpieces.Parent.Parent == armorpieces then
armorpieces:Clone().Parent = inv
break
end
end
currentArmor:Destroy()
end
end
end
end
return equipFunc
One thing is why are you printing inside the table. You can just do:
local bodypart = {
"Torso",
"Head"
}
local FakeBodyPart = Instance.new("Part", bodyPart.Torso) -- If I'm not wrong
The table I made is to store multiple stuff inside one variable but I dont think that will be practical in the script, my apologies.
local function EquipArmor(Player: Player, BodyPart: string, Armor: string)
-- BodyPart: string is to check which body part will be equipped with armor
-- Armor: string is to check for the armor inside the inventory
-- Player: Player well you know what this is for
local Character = Player.Character or Player.CharacterAdded:Wait()
local Inventory = player:FindFirstChild("Inventory")
-- Assuming that the player has an inventory inside the player
for i, v in pairs(Inventory:GetDescendants()) do
if v.Name == Armor then -- Making sure that the armor the player is trying to equip exists in the inventory
if not Character.BodyPart:FindFirsChild(tostring(Armor)) then
-- Assuming that the armor is located directly inside the body part of the player
-- and making sure that the same armor is not in the player (to avoid wearing 2 armors at the same time)
-- Equip logic
else
warn("Player is wearing armor")
end
end
end
Note that this is an example code of an equip function. You may place the code that welds the armor to the player, do more checks, etc.
hello there, I am here to announce an great news of armor system progression, so firstly, thanks to the 23th reply of this topic reply you made that I replied to had an specific line of code that has changed everything in good way, the line of code that I have benefitted from is the code line is shown below:
" ArmorWeld1.C1 = CFrame.new(0, 0, 0) – You can put any offset here, ".
and by applying this bit of code into the EquipArmor module script, the script now welds the chestplate Armor and the rest of the Armors with the player character correctly, without your bright suggestions on the 23th reply of this post, this process of armor making could’ve been taken extra months, thank you so much for contributing to my topic post, there is issue of player character’s arm being little sticking out from the chestplate, and the Talisman type armors being welded in wrong side of the player, but I will be sure to fix this issue since I have just solved an main critical issues today.
without your suggestion, I would’ve been lost how I could make the armors correctly weld into player characters, so I am asking you if I could donate some small amount of around 50 R$ for contributing to this development of porting HowToRoblox’s armor system into R6, I am fine with donating my balance to your game, it’s because you deserve it for not giving up on me
The issue is you are welding the whole chestplate into one part directly which is why the plate shoulders won’t follow the arms. You can do this by separating them into multiple pieces, and welding each part into the arms (for example, weld left shoulder plate → left arm). I hope this helped.
The 50 R$ donation is completely up to you. I would greatly appreciate it though. I have some gamepasses in my game that costs 50, but again it’s completely up to you.
hello there! I have donated 50 R$ on one of your experiences, I just wanna say thanks for helping me with it, and I think I would have to close this topic soon as the main problems are solved,
oh yea I did had to problems of when player opens an ArmorGUI, the sound region music would duplicate/echo for some odd reasons, but I was able to solve the issue alone by learning a bit from other forum posts on the devforum, and the sound region music wouldn’t echo again in my experiences!
I still has an problem with my RPG game experience’s boss health bar assets/childrens not being duplicated inside an extra GUI frame on the StarterGui/PlayerGui and then Destroying the contents copied from boss health bar (contents from BillBoardFrame above bosse’s head), so I will write another Topic on the scripting support channel regarding about this issues, it would be helpful and nice if you could visit my new topic again help me with the issues again
I will mark solution on this topic after I have done writing an new topic on the scripting support channel - mari
Woah, thanks alot. The 50R$ donation wasn’t necessary but I also wanna say thanks.
About your new topics, I will check it out. Again, thank you.
hello there ;D I have made new topic post on the scripting support channel, feel free to visit there anytime soon
you should definitely try to help me with the Boss Health Gui by clicking on this Hyperlink ;>
– mari
I’ll try checking it out this sunday.