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

Clone() script over clones itself?

Asked by 5 years ago

Was having an issue with a clone script that clones shirt and pants way too much than its meant to. Not sure what I am doing wrong but any help is appreciated.

local event = game.ReplicatedStorage.Events.Uniform
local prtcl = game.ReplicatedStorage.Storage.B2:Clone()
local t60p = game.ReplicatedStorage.Uniforms.t60.T60Pants
local t60s = game.ReplicatedStorage.Uniforms.t60.T60Shirt
local bp = game.ReplicatedStorage.Uniforms.t60.Armor

event.OnServerEvent:Connect(function(Player, Arg, Tool)
    local removeclothes
    local grabclothes
    local c
    if Arg == 1 then
        local character = Player.Character
        if character["T60 Power Armor"] then
            local p = Player
                c = character
            folder = game.ReplicatedStorage.Storage.PlayerUniforms[p.Name]
            removeclothes = function()
                for i,v in pairs(c:GetChildren()) do
                    if v:IsA("Shirt") or v:IsA("Pants") or v:IsA("Accessory") then
                    v.Parent = folder
                    c.Head.Running.SoundId = "rbxassetid://867429252"
                end
                t60p:Clone().Parent = c
                t60s:Clone().Parent = c
            end
        end
        if Player.Uniform.Value == false then
            print("Removing Clothes")
            removeclothes()
            c.Humanoid.MaxHealth = 200
            c.Humanoid.Health = 200 
            Player.Uniform.Value = true
        end
    end
end)

Answer this question