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

Instead of clothes how do I make it so you wear a object?

Asked by 3 years ago
local Pants = script.Pants
local Shirt = script.Shirt

script.Parent.ClickDetector.MouseClick:connect(function(Player)
    local Character = Player.Character
    if Character == nil then return end

    -- Get new shirt
    local CharacterShirt = Character:findFirstChild("Shirt")
    if CharacterShirt then CharacterShirt:Destroy() end
    Shirt:Clone().Parent = Character

    -- Get new pants
    local CharacterPants = Character:findFirstChild("Pants")
    if CharacterPants then CharacterPants:Destroy() end
    Pants:Clone().Parent = Character
end)

I wan't to make it so you can wear a object instead of shirt's and pant's.

2 answers

Log in to vote
1
Answered by 3 years ago

here's my example this puts a little part on your characters back.

make sure to make this as a LocalScript in StarterCharacterScripts.

this is only an example! you can always make welds differently.

local Player = game:GetService("Players").LocalPlayer
local PartToWeld = Instance.new("Part")
PartToWeld.Parent = workspace
PartToWeld.Anchored = false
PartToWeld.CanCollide = true
PartToWeld.Size = Vector3.new(1,2,1)
local Weld = Instance.new("Weld")
Weld.Part0 = Player.Character:FindFirstChild("Torso") or Player.Character:FindFirstChild("UpperTorso")
Weld.Part1 = PartToWeld
Weld.C0 = CFrame.new(0,0,1)
Weld.Parent = Weld.Part0

repeat
    wait()
until Player.Character ~= nil
0
Thanks, but anyway I can use this in my original script, because I have a click detector setup so when you click it, it give's you whatever. Thanks again Asherharding10 12 — 3y
0
could you mark the answer as correct please TheLuminent 1204 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Weld the object to the body part For example lets say you want body armor you use Weld To connect the body armor to the body part for example the torso or upper torso

0
This is pretty vague, if you could explain more that would be nice. Asherharding10 12 — 3y

Answer this question