local bg = game.ReplicatedStorage.BG
local plr = game:GetService("Players")
local lvl = {}
plr.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(char)
lvl = {
bg.BaseGloves;
bg.BaseGloves2
}
local function CloneFunction(nxtGlove)
local rHand = char:FindFirstChild("RightHand")
local lHand = char:FindFirstChild("LeftHand")
local gClone = nxtGlove:Clone()
local g1Clone = gClone.RightGlove
local g2Clone = gClone.LeftGlove
local g1c_Weld = gClone.RightGlove.WeldConstraint
local g2c_Weld = gClone.LeftGlove.WeldConstraint
wait(0.3)
gClone.Parent = char
g1Clone.CFrame = char.RightHand.CFrame * CFrame.Angles(0,0,0) * CFrame.new(0,.169,0)
g2Clone.CFrame = char.LeftHand.CFrame * CFrame.Angles(0, math.rad(180), 0) * CFrame.new(0,.169,0)
g1c_Weld.Part1 = char:FindFirstChild("RightHand")
g2c_Weld.Part1 = char:FindFirstChild("LeftHand")
g1Clone.CFrame = char.RightHand.CFrame * CFrame.Angles(0,0,0) * CFrame.new(0,.169,0)
g2Clone.CFrame = char.LeftHand.CFrame * CFrame.Angles(0, math.rad(180), 0) * CFrame.new(0,.169,0)
g1Clone.CanCollide = false
g2Clone.CanCollide = false
end
for i, p in ipairs(game.Players:GetChildren()) do
print(i,p)
if p then
for i, v in ipairs(lvl) do
if v.TypeVal.Value == player.gloveLVL.Value then
CloneFunction(v.TypeVal.Parent)
print(v.TypeVal.Parent)
print(i,v)
end
end
end
end
char.Humanoid.Died:Connect(function(hum)
wait(3)
player:LoadCharacter()
end)
end)
wait(3)
player:LoadCharacter()
end)
There’s a few things that are confusing me, Firstly, why is the local function inside of CharcterAppearanceLoaded? That’s just going to recreate it everything time a characterloads, I think it’s better you put that after local lvl = {}
Another thing is why is the loop inside of a loop that goes through all the players when a specific characterloads?
If it errored I don’t think it would’ve even placed gloves on the players in the first place since it’s directly above the rest of the code so it wouldn’t even put gloves on