For loop only cloning model to one player instead of every player

That’s odd, I think something is wrong with the function or the code that executes it. but most likely the code that executes it. Maybe in the loop, add

for i, v in ipairs(lvl) do
	if v.TypeVal.Value == player.gloveLVL.Value then
		CloneFunction(v,char)
		print(char.Name)
		print(i,v)
	end
end

And in the function, at the start before local rHand, add

print("Adding "..nxtGlove.." to "..char.Name)

It said “Adding BaseGloves to Player 1”, but ignored player 2. The for loop still knows what model to add to the player though.

Did it recognize Player2 in the For loop bit?

When I tried the test again it noticed player 2 but not player 1 this time. I also get an error saying, “ServerScriptService.main_Glove:6: attempt to index nil with ‘Name’” which I think has to do with the code ignoring the player. I am just not sure what nil is supposed to be.

nil is basically Luau terms for non existing, it didn’t recognize char so it returned nil. Try this for the PlayerAdded

plr.PlayerAdded:Connect(function(player)
	print("Name of Player is "..player.Name)
	player.CharacterAppearanceLoaded:Connect(function(char)		
		for i, v in pairs(lvl) do
			if v.TypeVal.Value == player.gloveLVL.Value then
				print(char.Name)
				print(i,v)
				CloneFunction(v,char)
			end
		end
		
		char.Humanoid.Died:Connect(function()
			wait(3)
			player:LoadCharacter()
		end)
	end)
end)

I know what nil is. I just meant I wasn’t sure what was being called nil.

I will try printing in playeradded though.

If the error was Name being indexed with nil, then for some reason it’s not recognizing the Character

It recognized both players when I went on the test.

We’re getting there, now try adding this print

player.CharacterAppearanceLoaded:Connect(function(char)		
		print("Character belonging to " .. char.Name " has loaded") --This
		for i, v in pairs(lvl) do
			if v.TypeVal.Value == player.gloveLVL.Value then
				print(i,v)
				CloneFunction(v,char)
			end
		end
		
		char.Humanoid.Died:Connect(function()
			wait(3)
			player:LoadCharacter()
		end)
	end)

If it recognized both players but not the characters then something is going wrong somewhere, jsut not sure where

Yeah it still only notices one character some times when it prints. When I change it to CharacterAdded it recognizes both characters though.

Maybe you can try using CharacterAdded instead if you said it recognized both

Edit: Maybe if it works too, you can get rid of the char.Humanoid.Died event for Setting the RespawnTime to 3

Ok I will try out something with the respawn time and tell you if it works.

I’m getting close I think I might have to add an if statement that checks if the player spawned with the model though.

Im not sure if you can do a player.CharacterAppearanceLoaded:Wait() inside of the CharacterAdded event since it may infinitely yield, but you can try it

Or alternatively just do a 1 second wait which should only really be a last resort

Is the script a Local Script or a Server Script?

The script is made for the server.

Are you sure the reason its not looping through every player is because instead of using the p variable in your loop. You’re referencing “player”.

Not sure what your script does but you’re looping through every player and comparing the TypeVal to a different players gloveLVL.