--//Armour
for i, v in pairs(Armour.ArmourTable) do
if item == v.Name then
if state == "Equip" then
-- EquipArmour
local char = player.Character -- Gets Players Character
local currentArmorFolder = char:FindFirstChild('Armor') -- Get's CurrentArmorFolder
if not currentArmorFolder then -- If there isn't one then it will make one
currentArmorFolder = Instance.new('Folder')
currentArmorFolder.Name = 'Armor'
currentArmorFolder.Parent = char
end
local currentArmor = currentArmorFolder:GetChildren() -- Gets Current Armor
local newArmor = bp:Clone() -- Clones armor
local children = newArmor:GetChildren() -- Gets the Children of Armor
for i = 1, #children do -- For loop through all items in the armor
local SelectedArmorPiece = children[i]
if SelectedArmorPiece:IsA("Configuration") then -- If it is a folder then Ignore
-- Do nothing, Ignore it
else
local weld = Instance.new("Weld")
local playerBodyPart = char:FindFirstChild(SelectedArmorPiece.Name) -- getting the armour name and the players limb name, so arm and arm
weld.C0 = SelectedArmorPiece.CFrame:ToObjectSpace(playerBodyPart.CFrame) -- This may be the issue
weld.Part0 = playerBodyPart
weld.Part1 = SelectedArmorPiece
weld.Parent = SelectedArmorPiece
SelectedArmorPiece.Parent = char.Armor
end
end
Update.UpdateArmor(player, serial)
elseif state == "UnEquip" then
Update.UpdateArmor(player, 0)
-- // need to unequip
local currentArmorFolder = char:FindFirstChild('Armor')
local currentArmor = currentArmorFolder:GetChildren()
if #currentArmor > 0 then
for i = 1, #currentArmor do
local selectedPart = currentArmor[i]
selectedPart:Destroy()
end
end
end
end
end
For some reason this doesn’t work, so I don’t wear the armour, but I am connected it to it, because I get weird Collisions when I have it equipped. The armour has cancollide off, and anchor off. So Any help would be appreciated. Thank you.
I’m not sure why this doesn’t work. The armor doesnt get equipped.
I’ve also tried SelectedArmorPiece.CFrame:inverse() * playerBodyPart.CFrame
and vice versa, I’ve tried welding different parts and can’t seem get it to work.
I still haven’t been able to make this work, I took a break for a little bit, and when I can back I still couldn’t figure it out. Please if anyone does read this, and knows what I am doing wrong please let me know. Thank you.
I’d recommend using Humanoid:AddAccessory() Where all you do is put in a joint into the piece of armor, calling the brick holding the entire thing handle and welding all the bricks to it. Then you could just use 1 line of code to apply armor to the character easily.
So here we have the armor piece, it can have anything that you want. In order for everything to work here though you need to weld everything to each other. In order to do this you can use a plugin rather than a script because the script will just lag the game.
Then once you got your armor you should group it to separate it from the part from which we will be welding like here: You see a Torso joint so this means when we run the command it will know that we want to apply this to the torso rather than any other part of the body. You can move it up,down and sideways to offset the armor to your needed position and as well rotate it.
Make sure to name it Handle or else it wont work and weld it to other parts in the now made model of other armor pieces we made. Make sure all the parts, including the handle aren’t anchored and have CanCollide set to false and move it to Lighting or where ever your armor is.
In the brackets you put the location of the dedicated armor piece and it’s name. It can be called anything. If you are using this in gameplay style then you want to to something like :AddAccessory(game.Lighting.Torso:Clone()) To make sure that next time if you want to apply it after death that it’s still there to be used.
Make sure that the Handle and the Model are inside of an accessory and that Handle is directly child of the accessory if it’s in the model with other parts it won’t work!
In the end after running the command we end up with this.
I have read everything you have said, Also looked at the developer doc. So I have something like this:
Character is R15. I put this on my character and it just falls straight through the world. Do I have to add more attachments the same as the R15 or should this just work.
Anchored and can collide is false.
When I run the game it stays on the dummy;
but when I add it to my character it just falls.