NameTag not working

it could be done this way

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		
	
	local function typeWrite(textbox, text)
			for i=1,#text,1 do
				textbox.Text = string.sub(text,1,i)
				wait(0.1)
			end
		end
		
		local plrtag = script.NameGui:Clone()
		plrtag.Parent = char:WaitForChild('Head')
		plrtag.overhead.UserName.Text = string.upper(plr.Name)
        while wait() do	
		for _, IntValue in pairs(script.SettingsContainer.Configuration.Groups:GetChildren()) do
			if IntValue:IsA("IntValue") then
						typeWrite(plrtag.overhead.Division, tostring(string.upper(plr:GetRoleInGroup(9536284)))						
                        wait(1)
						typeWrite(plrtag.overhead.Division, tostring(string.upper(IntValue.RegimentName.Value)))
						wait(1)
						typeWrite(plrtag.overhead.Division, tostring(string.upper(plr:GetRoleInGroup(IntValue.Value)))
					end
				end
end
	end)
end)

This worked! Thank you very much.

1 Like

Your welcome, Glad I was able to help!

coroutine.wrap would have worked you just forgot to call the function that it returns.

coroutine.wrap(function()
	while true do		
		for _, IntValue in pairs(script.SettingsContainer.Configuration.Groups:GetChildren()) do
			if IntValue:IsA("IntValue") then
				typeWrite(plrtag.overhead.Division, string.upper(plr:GetRoleInGroup(9536284)))
				wait(1)
				typeWrite(plrtag.overhead.Division, string.upper(IntValue.RegimentName.Value))
				wait(1)
				typeWrite(plrtag.overhead.Division, string.upper(plr:GetRoleInGroup(IntValue.Value)))

			end
		end
	end
end)() --Calls the returned function.
1 Like